how to handel failure mails using PHP?
- by Navruk
example:-
If i sent a mail through gmail to this id "nkhkhlkhlkjlkjkljlkjlk@gmail.com"
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: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
$to = "nkhkhlkhlkjlkjkljlkjlk@gmail.com";
$subject = "Testing";
$message = "Testing body";
mail($to, $subject, $message, $headers);