Jump to content

mail() not sending


Recommended Posts



I am trying to use mail(), but when I try it i am not receiving the email.  Code is as follows


//email user
$subject='Thank you for registering at iSpeedwayScores';
 $message ='<html> 
  <body bgcolor="#000000" style="color:#FF9900; font:Verdana, Arial, Helvetica, sans-serif"> 
        <h1>Welcome to iSpeedwayScores</h1> <br/> 
        <p>Hi!</p> <br> 
        <p>Thank you for joining iSpeedwayScores, this is your <b>FREE</b> online speedway scorecard site.</p>
<p>Your login details are provided below:</p>
    Username: '.$username.'<br/>
Password: '.$password.'<br/> 
      <p>We hope you enjoy using the site, if you do, please tell others, if not please tell us</p>
   //end of message 
    $headers  = "From: $from\r\n"; 
    $headers .= "Content-type: text/html\r\n"; 
    //options to send to cc+bcc  
    $headers .= "Bcc: mark@bravo14.co.uk"; 
    // now lets send the email. 
    if(mail($to, $subject, $message, $headers)){
$message=" Message sent successfully";
$regsuccess = "Message sent successfully";
$message=" Message not sent";
$regfailure ="Message not sent";
Although I get the Message sent successfully notification on screen.
Link to comment
Share on other sites

have you ever successfully sent an email from the server where this is running? does your web host have any smtp authentication or other requirements to send email?


there may be a mail server that accepted the email from the php mail() function and didn't return an error to php, but that mail server may not have any intention, or ability, of actually sending the email to the recipient or it may not even be the correct mail server to use at your web hosting.


it's also possible that the dns records where the domain in your From: address is hosted at are either nonexistent or miss-configured such that the receiving mail server cannot determine if the sending mail server is authorized to send the email, in which case the receiving mail server may simply discard the email.


is the From: address an actual working mail box, so that any bounce/error messages from the receiving mail server would have a place to go and can be viewed? and while the From: address should get used as the Return-path: address for bounce messages, you can specifically include a Return-path: in the header.


edit: also, which email address are you not receiving at, the To: address that you are entering in the form (and have you confirmed that the form is posting a value to the code), or the Bcc: address that's in your code or both?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.