I am working on an application which sends email to a couple of users. But the application also needs to know about the emails that get bounced. I searched on google and go to know that you need to define a return path. Here is the code
Code: Select all
$user_id=13;
$return_path = "user-".((int)$user_id)."-bounce@gmail.com";
$to = 'siji_eli@yahoo.com';
$subject = 'Test email';
$message = "Hello World!\n\nThis is my first mail.";
$headers = "From: beths86@gmail.com\r\nReply-To: beths86@gmail.com";
$mail_sent = mail( $to, $subject, $message, $headers,"-f".$return_path);
echo $mail_sent ? "Mail sent" : "Mail failed";Apart from this, is there any other method for the PHP Script to know when the email gets bounced. pls help
Thanks in advance.