Jump to content

PHP Mail Function Issues.


shanejeffery86

Recommended Posts

Hey there guys.

 

I have thrown my hands up in the air with the PHP Mail function.

 

The IF statement that I am running, is returning "true".  Therefore, if it is returning "true", I would assume that the e-mail is being sent out.  No such luck...

 

	// formating the mail posting
// headers here
$header = "[email protected]";
$header4 = "Reply-to: $header\n";
$header4 .= "From: $header\n";
$header4 .= "Errors-to: $header\n";
$header4 .= "Content-Type: text/html; charset=iso-8859-1\n".$header;

$subject = "Your Request For Login Details";
$body = "This is in response to your request for the generating of a new password for myESC India. \n \nLogin ID: $email \n Password: $rnd_pw \n\n Thank You \n \n MyESC Staff";

// mail funciton will return true if it is successful
if(mail($email,$subject,$body))
{
	echo "<center><font face='Verdana' size='2' ><b>THANK YOU.</b> <br>Your new password has been sent to the e-mail address you specified.</center>";
}
else // there is a system problem in sending mail
{	
	echo " <center><font face='Verdana' size='2' color=red >There is some system problem in sending login details to your address. Please contact site-admin. <br><br><input type='button' value='Retry' onClick='history.go(-1)'></center></font>";
}

 

Any reason that the following line:

 

		echo "<center><font face='Verdana' size='2' ><b>THANK YOU.</b> <br>Your new password has been sent to the e-mail address you specified.</center>";

 

would return true if the mail does not even send.

 

I have tried sending the mail to a variety of e-mail addresses/hosts and nothing comes through.

 

Any ideas?

 

Thanks guys.

Link to comment
https://forums.phpfreaks.com/topic/120899-php-mail-function-issues/
Share on other sites

mail() will deliver a TRUE result if it was successful - that just means it was accepted for delivery, not that it was delivered:

 

Return Values

 

Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise.

 

It is important to note that just because the mail was accepted for delivery, it does NOT mean the mail will actually reach the intended destination.

 

(from the PHP manual).  the mail could not be getting sent (or accepted) because it has no headers.  you construct headers, but don't send them.  try adding that to the mail() parameters and see if it helps.

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.