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
https://forums.phpfreaks.com/topic/104596-check-if-mail-is-sent/
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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.