Centos – Postfix not forwarding email

centoscentos7emailemail-serverpostfix

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

Best Answer

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 :)

Related Topic