2

I have CentOS 7 on my Linode server and I'm trying to forward incoming emails to one of my domains on this server (mail@domain.com) to my gmail address (me@gmail.com), have done this before, but I'm stumped on why it's not working now as I'm trying to set it up.

I'm following this guide: https://linuxaria.com/pills/how-to-setup-postfix-to-forward-email-to-another-email-account-on-debianubuntu

And others like it: - https://www.andreagrandi.it/2014/08/31/getting-started-with-digital-ocean-vps-configuring-dns-and-postfix-for-email-forwarding/ - http://willjackson.org/blog/configure-postfix-forward-e-mail-external-address

Added this to /etc/postfix/main.cf:

virtual_alias_domains = example.com
virtual_alias_maps = hash:/etc/postfix/virtual

And in /etc/postfix/virtual:

mail@example.com  myemail@gmail.com

Did "postmap /etc/postfix/virtual" and then reloaded and restarted Postfix. But sending emails to mail@example.com still isn't getting redirected to my gmail address...

What could I be missing here, does anything else need to be updated in main.cf for email forwarding?

Update - For some reason, not seeing anything show up in my logs (/var/log/maillog) when sending an email to mail@example.com:

enter image description here

  • What's in the maillog? – Michael Hampton Aug 20 '16 at 7:17
  • Not seeing anything show up in the logs (/var/log/maillog) when sending an email to mail@example.com... and I set up an MX record on this domain too, and flushed iptables – Sayem Khan Aug 20 '16 at 7:30
  • If there's nothing in maillog it seems likely that the messages aren't reaching your server at all. What happens if you try connecting to the SMTP port on the server by hand (using telnet, nc, swaks or similar) from where you're sending the messages. If that works then perhaps you need to check your MX records. – Paul Haldane Aug 20 '16 at 9:26
  • Yeah that works, problem that was causing it was inet_interfaces in main.cf was set to localhost, I had to change it to all – Sayem Khan Aug 21 '16 at 2:44
2

Finally fixed it, so the error message emails that bounced back from the mailer daemon said:

Technical details of temporary failure:
The recipient server did not accept our requests to connect. Learn more at https://support.google.com/mail/answer/7720
[mail.example.com. XX.XX.XX: socket error]
[mail.example.com. XX.XX.XX: socket error]

And searched around and came across this thread with the same problem: https://www.digitalocean.com/community/questions/postfix-mail-forwarding-socket-error-how-to-fix-mx-records

Needed to set "inet_interfaces = all" in /etc/postfix/main.cf, that did it :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.