how to handel failure mails using PHP?

Posted by Navruk on Stack Overflow See other posts from Stack Overflow or by Navruk
Published on 2011-01-17T10:41:37Z Indexed on 2011/01/17 10:53 UTC
Read the original article Hit count: 295

Filed under:
|
|

example:-

If i sent a mail through gmail to this id "[email protected]"

i got error like "Delivery to the following recipient failed permanently:"

My question is:-

If i sent using PHP mail function, how can i catch failure email id?

code:-

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'To: Mary <[email protected]>, Kelly <[email protected]>' . "\r\n";
$headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n";
$headers .= 'Cc: [email protected]' . "\r\n";
$headers .= 'Bcc: [email protected]' . "\r\n";

$to = "[email protected]";
$subject = "Testing";
$message = "Testing body";

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

© Stack Overflow or respective owner

Related posts about php

Related posts about email