Jump to content

check if mail(); is sent?


Recommended Posts

just a quick quest, how do i check if an email is sent? this is my email code

$to      = $user_email;
$subject = 'Welcome,'$user_name;
$message = "Hello,$user_name<br> welcome to the Random Game Design Template System<br> Congratulations on succesfully creating your site. This email can be fully customised in the admin centre $homepage.";
$headers = 'From: RGD TS' . "\r\n" .
       'X-Mailer: PHP/' . phpversion();

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

can i just add

if(mail()
{
//my code
}
else
{

}

 

Link to comment
Share on other sites

A TRUE status returned by the mail() function only means it was able to talk to the mail server and the mail was accepted for delivery. After an email has been accepted for delivery, a lot of things could happen that could result in the mail not being sent.

Link to comment
Share on other sites

yes indeed, however, IMHO, after the mail server has accepted the mail for delivery then the other problems are outside the coders control. so a quick and simple check to see whether the mail has been handed over successfully to the mail server is to check for a TRUE return statement from the function.

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.

Guest
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.