9

I have a php file that sends mail using the mail() function. The problem is one of the forms sends to a domain that is registerred on my server while having the mail handled on a different server. Postfix looks locally only. When it doesn't find the email address is rejects the message. How can I configure postfix to send mail to all domains through the internet and not locally?

Update

Ok. So it wasn't a postfix issue at all. I simply needed to turn off mail to that domain from the command line. For anyone that needs that command it is (at least on my system):

/usr/local/psa/bin/domain --update example.com -mail_service false
4

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 example@gmail.com but not to example@domain.tld

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.

| improve this answer | |
1

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.

| improve this answer | |
  • This is what my mydestination looks like: mydestination = $myhostname, localhost.$mydomain, localhost – LoneWolfPR Jan 12 '12 at 3:41
  • the weird thing is i've changed it, but it still doesn't show what i see in the main.cf file – LoneWolfPR Jan 12 '12 at 3:45
  • Try a postfix reload to reload your config… – fission Jan 12 '12 at 4:11
  • Turns out the solution wasn't in postfix to begin with. Posted an update with the answer since I can't answer my own questions yet. Thanks for taking the time though. – LoneWolfPR Jan 12 '12 at 4:33
  • Probably would have been helpful to know that it wasn't "vanilla" postfix and that you were using Plesk. ;-) Glad to hear it's sorted now. – fission Jan 12 '12 at 4:45
1

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.

| improve this answer | |

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