Ubuntu – Configuring Mail Relay

postfixUbuntuubuntu-9.10

I'm running Ubuntu Server 9.10 with Postfix and Webmin.

I have created virtual hosts for 3 domains following this serverfault.com answer.

But the mail isn't relaying out to the world. I have 3 domains tied into my DNS in webmin, as well as inside DNS clicked Mail Server and followed that instruction using this article on the web.

The domains and the web servers work just fine. I also have FTP working just fine. So, the remaining problem I have is mail. Can't forward mail out to a Gmail account for some reason. Note I'm just trying to do the "easy version" of Postfix config and if your answer is in Webmin-ease, that would help me. However, I can edit a text file if you suggest.

I was asked to include some /var/log/mail.log stuff, so here it is:

May 24 16:43:26 uc6 postfix/smtpd[432]: NOQUEUE: reject: RCPT from mail-gy0-f176.google.com[209.85.160.176]: 554 5.7.1 <support@example.com>: Relay access denied; from=<testacct@gmail.com> to=<support@example.com> proto=ESMTP helo=<mail-gy0-f176.google.com>

Also, looks like I'm getting hit by random port scanners trying to look for open relays:

(note I changed my IP address below to 55.55.55.55 for privacy)

May 24 13:40:54 uc6 postfix/smtpd[29311]: NOQUEUE: reject: RCPT from 123-204-7-37.dynamic.seed.net.tw[123.204.7.37]: 554 5.7.1 <sseenndd0101@yahoo.com.hk>: Relay access denied; from=<h6koo9b46u@yahoo.com.tw> to=<sseenndd0101@yahoo.com.hk> proto=SMTP helo=<55.55.55.55>

Best Answer

Found it. After setting up mail aliases in Webmin's Postfix module, I had to edit:

/etc/postfix/main.cf

And add in this line...

virtual_alias_domains = example1.com example2.com

...where exampel1.com and example2.com are 2 domains I want to forward mail on...

...added above this line...

virtual_alias_maps = hash:/etc/postfix/virtual

I then had to run these commands:

postmap /etc/postfix/virtual
postfix reload

It then worked after that.

SOURCE: http://www.postfix.org/VIRTUAL_README.html (search for "relay access denied")