postfix: force server to send mail outside of localhost [closed]

Solution 1:

I solved the simillar problem. As you write in your update you have to switch off mail service for domain by /usr/local/psa/bin/domain --update example.com -mail_service false command - it should work in most cases. Anyway I made another mistake and switching mail service off was not enough solution form me.

At first I should check my DNS settings. I have DNS hosted outside of Plesk server but I set that DNS is managed by server (default option) during domain creation - this was the only mistake. Then everything was working well except sending mails to domain managed by Plesk. Then mail was sent successfuly from domain.tld to [email protected] but not to [email protected]

The solution for me was disable DNS Service for domain in Plesk Control Panel. It could be done via DNS Settings in Control panel for domain.

Solution 2:

It sounds like your $mydestination is wrong. Check its current value on your system with the command:

postconf mydestination

By default, postfix delivers mail only to the local host, not the entire domain:

% postconf -d mydestination
mydestination = $myhostname, localhost.$mydomain, localhost

If you need to adjust that, edit /etc/postfix/main.cf.

For more information on common Postfix scenarios, consult the standard configuration examples. You can also see information specifically on mydestination.

Solution 3:

you could also use the /etc/postfix/transport file to selectively define which smtp server should handle what domains mails. Like, if you want to send mydomain.com email to smtp.mydomain.com you could write into /etc/postfix/transport:

mydomain.com  smtp:[smtp.mydomain.com]

Dont forget to do postmap /etc/postfix/transport afterwards, to create the .db file postfix uses.