I have set up a postfix mailserver, and now I can send emails connecting to the smtp server through 'localhost', port 25.
But I don't know how to check as which user the mail has been sent. I can send without authenticating myself, though it's not an open relay: it seems to work only for localhost.
I would like to be forced to authenticate, or at least know which user is sending the mail, so I can set a quota for him, and a permitted 'from' (right now I can pick any of the available domains as 开发者_StackOverflow社区the sender, when sending through a php script)
I couldn't find anything other than the mail 'from' and 'to' in /var/log/maillog.
Any ideas?
You're question(s) is very confused.
I'll assume you are talking about what happens when you use the 'mail' command; on a Unix system this just runs a program defined in the php.ini file - there are libs which allow you to send a mail by creating a network connection to a MTA - in which case the uid is not available directly to the MTA - and is the scenarion in which most admins would configure authentication.
The uid of the sender will be the uid as whom PHP runs as.
Whether or not the MTA requires authentication has little to do with the uid invoking mail.
In this scenario, the sender of the email will be the FROM address of the email.
I would like to be forced to authenticate
Then use a socket based mailer such as phpmailer() and configure your MTA to require authentication.
精彩评论