I can't seem to send mail through my php scripts or through the linux console on my Centos 5.5 LAMP server, when the email is addressed to go to a domain that is hosted by my box.
I think it is something to do with the email routing internally, or the DNS servers that the box uses not reporting the correct MX records.
Basically my box doesn't host any mail, it's all hosted on google apps. My name servers are hosted by a 3rd party provider and I am using webmin. Webmin doesn't recognise the settings on the 3rd party provider.
I'm unsure how to fix this. Previously when I had this problem on a cpanel server, I would edit the remotedomains
and localdomains
files, moving domains from one file to another and it would fix the problem.
What information do I need to provide for anyone to work out what the issue is?
Thanks
If you run
sendmail -bt
(test mode for sendmail) and then type$=w
you will see that the domains that you have problem with are listed. This is because sendmail believes that the mail addressed to said domains must be delivered locally in the box, instead of sending it to Google. So what you have to do is to modify your sendmail.mc in two places (or add them if they do not exist).First in the LOCAL_CONFIG section add a map that looks up the best MX for a domain:
Next, in the LOCAL_RULE_0 section where sendmail selects a delivery agent use the map above to route mail to Google:
Note 1: replace example.com with the domain in question
Note 2: Do not copy paste the rules in your sendmail.mc. Type them for the left and the right hand side of the rules are not separated with spaces but with tab characters.
Note 3: After you've done editing sendmail.mc, you have to build sendmail.cf and then restart sendmail. I do not know how this is done in CentOS. I run Debian and execute
sendmailconfig
You can read a more detailed explanation on the problem in my blog post here.