Showing results for 
Show  only  | Search instead for 
Did you mean: 

PHP mail not sending after fixing mx records

Hi all,

I'm sorry, I know this issue has come up many many times, and I'm sure it will come up many more times after this, but I'm having trouble using the PHP mail() function. The simple script worked on an old host with no issue other than latency however I can't get it to work here on GoDaddy. I've read over and over that I need to change my MX Records which I have now done. The MX Records point to the correct destination (I hope) and uses the correct subdomain. I run the script and nothing happens.


Anyone got any ideas on how I may be able to fix this before I ring GoDaddy's Help Centre?

My 'simple mail script' is as follows:


 (For testing purposes only. User enters email address and the sending.php script uses the input as a target address)


<form action="sending.php" method="post" name="sendMail">

  <input type="email" name="email">
  <input type="submit">




(sending.php script)


$to = $_POST['email'];

$subject = 'the subject';
$message = 'hello';

mail($to, $subject, $message);


Thank you in advanced for any support and assistance. 🙂


Hi @srcurtis,

I had to do some digging to get everything working properly myself ( no issues with sending though did have issues with mail going to spam ). Though you are missing some important headers, as well as a "from" email address and some other necessary code to prevent the email from going to spam with gmail and such.


Here is some general info on setting up php mail with godaddy :


Try this :



$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

$headers .= 'From:DisplayName<>' . "\r\n";

$headers .= '' . "\r\n";
$headers .= '';

$to = $_POST['email'];

$subject = 'the subject';
$message = 'hello';



 Edit the "" to a physical email address set up on the same domain you are sending from. Set this email up in the Workspace section of GoDaddy ( assuming that's what you are using ), this will help you email getting verified. As for your MX record, I am not sure what you did, though you may also need to add a new line to your DNS settings to also prevent the email from going to spam. This isn't necessary for actually sending email.

More on that here :