Send email from PHP and catch the autoresponses
I'm sending emails using a PHP script and class.phpmailer.php. I need to be able to 'catch' bounces and auto-responses. I'm able to catch the bounces already. I created an alias that redirects bounces to a php script, and I parse the email there. I include some information in the original email in the headers, so I can know which emails bounced.
The same logic should work for the auto-responses, I think the problem is that the email are not getting to the server. I already have a reverse DNS configured, pointing to the server IP address.
This is part of how I send an email:
$mail = new PHPMailer();
$mail->From = $fromAddr;
$mail->Sender = $sender;
$mail->FromName = $fromName;
$mail->AddAddress($email);
$mai开发者_开发百科l->IsHTML(true);
$mail->Subject = $subject;
the I add the headers, for example:
$mail->AddCustomHeader($mail->HeaderLine("From", $fromAddr));
$mail->AddCustomHeader($mail->HeaderLine("Subject", $subject));
$mail->AddCustomHeader($mail->HeaderLine("Company-State", "Florida"));
$mail->AddCustomHeader($mail->HeaderLine("Company-Country", "USA"));
$mail->AddCustomHeader($mail->HeaderLine("From", $fromAddr));
$mail->AddCustomHeader($mail->HeaderLine("Reply-To", $fromAddr));
My RDNS is something like: mail2.mydomain.com. The bounces are going to "www-data". What should I add and where? something like www-data@mail2.mydomain.com?
Tks!
精彩评论