how to handel failure mails using PHP?
- by Navruk
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);