Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can't send email to addresses at my own domain

Tags:

php

email

dns

I have a simple php script on my domain that sends me an email:

... $toMail = "[email protected]"; //this works - I get the email at my gmail $toMail = "[email protected]"; //this doesn't - I get nothing  mail($toMail, $subject, $message, $header);  

What setting to I change to fix this?

like image 259
sol Avatar asked Jul 10 '09 04:07

sol


People also ask

Can I make an email with your own domain?

You can create an email address using your custom domain like [email protected] and connect it directly to your Gmail account. This means you'll get all the convenience of the Gmail platform, but with your business name in the email address instead of Gmail.com.

Why is my email domain not working?

Your domain host disabled your account–Common reasons for a disabled account is your domain registration expired, or there's an issue with your domain host payment. Your domain registration isn't complete–When you buy or renew a domain, your domain host verifies your email address.

Why can I receive emails but not send emails?

This error usually indicates the failure of your email program to connect to port 25, the SMTP (outgoing mail) port. One of the following is the likely cause of this problem: Your firewall blocks SMTP connections to an internet mail server.


2 Answers

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.

  1. Enter into the cPanel
  2. Go the the cPanel Mail section
  3. Search for MX Entry Maintenance, sometimes there is no text above the icon.
  4. Select the related domain
  5. Change Email Routing to Remote Mail Exchanger.
  6. 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
  7. 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

like image 61
VicM Avatar answered Sep 17 '22 22:09

VicM


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.

like image 25
schubySteve Avatar answered Sep 19 '22 22:09

schubySteve