I'm trying to get a python script to send mail (using smtplib.SMTP), but postfix is refusing to relay the message. I don't use the Ubuntu 10.10 Virtualmin server as a mail server (I happen to use google apps for that), but I want scripts to be able to send mail. Here is the log, with the addresses replsced with generic ones:
Apr 11 00:50:27 unimatrix-01 postfix/smtpd[25212]: connect from localhost[127.0.0.1]
Apr 11 00:50:27 unimatrix-01 postfix/smtpd[25212]: NOQUEUE: reject: RCPT from localhost[127.0.0.1]: 554 5.7.1 <example@gmail.com>: Relay access denied; from=<noreply@example.info> to=<user@gmail.com> proto=ESMTP helo=<unimatrix-01.example.com>
Apr 11 00:50:27 unimatrix-01 postfix/smtpd[25212]: lost connection after RSET from localhost[127.0.0.1]
Apr 11 00:50:27 unimatrix-01 postfix/smtpd[25212]: disconnect from localhost[127.0.0.1]
I have already tried with no success, to fix this by running # dpkg-reconfigure postfix according to the Ubuntu Docs. How can I fix this?
Thanks in advance.
Update: Interestingly, apps using PHP can send mail just fine. So, I suspect it has something to do with postfix requireing authentication locally. This is not necessary as I am use sole user of this VP. I hope this helps with troubleshooting.
Best Answer
Check if you permit local networks to relay emails without authentication.
First of all, the following command, should include permit_mynetworks
Then check if 127.0.0.1 is in $mynetworks. Just do,
and check if 127.0.0.1 is there.