can't send email to addresses at my own domain
For the people using Google Apps for email, but having your host in other provider this are more detailed instructions for the people that is not very familiar with cPanel.
I could fix the problem of sending email from my domain using a PHP form, when sending the email to an account inside my domain.
i.e. mydomain.com Contact form sending email to [email protected]. The above was not working even if my domain has the correct MX records for the domain using Google Apps.
As Mike noted (and others) above the problem was solved: Adding the MX records into the cPanel.
- Enter into the cPanel
- Go the the cPanel Mail section
- Search for MX Entry Maintenance, sometimes there is no text above the icon.
- Select the related domain
- Change Email Routing to Remote Mail Exchanger.
- Add all the google MX records as they are in your domain configuration using the appropriate priority values. You can check the records here and priorities https://support.google.com/a/answer/174125
- Double check that Remote Mail Exchanger. is selected.
With this setting I was able to send email using mail PHP function to an email account inside the same domain as my website.
Google App instructions talking about MX records https://support.google.com/a/answer/54717?hl=en
I've had this problem myself, when I was redesigning a site recently.
There was an issue with the way our system was set up, so that the system thought that because the email was coming from the same domain it was a spam email and as such blocked it.
Check with your system administrator that you are allowed to be sending the emails etc.
Either that, or you'll have to modify the headers to have look like it's being sent from an external address. Hope you get it sorted.
The top answer at https://serverfault.com/questions/65365/disable-local-delivery-in-sendmail seems correct to me. The gist of it is that you want the following in your sendmail.mc:
define(`MAIL_HUB`, 'example.com.')dnl
define(`LOCAL_RELAY`, 'example.com.')dnl
Where example.com is the domain in question.