This specific Linux CentOS server is entirely in-house on the LAN. It is used for development and testing. With postfix, I was able to configure it to send e-mail using a gmail account. However, anything on the system sent to root needs to be forwarded to an external e-mail account. But when that happens, it gets returned from Google's gmail because it doesn't know what to do with a local domain:
Address not found Your message wasn't delivered to [email protected] because the domain foobaz.localdomain couldn't be found. Check for typos or unnecessary spaces and try again. So far, in /root/.forward I put in [email protected] and listed [email protected] in /etc/aliases for user 'root'.
Here is the diff on /etc/postfix/main.cf file from the original file that is provided with postfix:
[root@foobaz postfix]# diff ORIGINAL_main.cf main.cf 119c119 < inet_protocols = all --- > inet_protocols = ipv4 679a680,690 > > myhostname = foobaz > > relayhost = [smtp.gmail.com]:587 > smtp_use_tls = yes > smtp_sasl_auth_enable = yes > smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd > smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.crt > smtp_sasl_security_options = noanonymous > smtp_sasl_tls_security_options = noanonymous > In the past, I recall without changing anything a Linux CentOS system would allow e-mail addressed to 'root' to go to the root mailbox. But the way I have it configured now with postfix, it ships everything off to Google's gmail to be resolved there, and of course, it can't be because I'm not using fully qualified domain. In addition, it won't work because it needs to find its way to the actual 'root' user for the /root/.forward and /etc/aliases to do their magic.
How can I add this capability so gmail will still work the way it is now for sending e-mail to the outside world, yet know that user 'root' needs to stay local on the system so it can be delivered to the 'root' mailbox ultimately to be correctly forwarded to an external e-mail address?
This exactly changed to the main.cf is what made this work:
mydestination = foobaz.localdomain, $myhostname, localhost.$mydomain, localhost