Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
share|improve this question

closed as off-topic by Falcon Momot, mdpc, Wesley, Avery Payne, Jenny D Apr 26 at 6:08

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is dedicated to professional system and network administrators. End user and enthusiast questions are off-topic (contact your system administrator or hire a professional to help you out). Please see the Help Center for more information." – Falcon Momot, mdpc, Wesley, Avery Payne, Jenny D
If this question can be reworded to fit the rules in the help center, please edit the question.

3 Answers 3

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.

share|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

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.

share|improve this answer

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.

share|improve this answer

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