cfortune / PHP-Bounce-Handler

This class can be used to parse bounced message reports. It parses e-mail messages with multipart report content type formatted according to RFC 1892 and 1894 documents. If the bounce is not well formed, it also tries to extract some useful information. Exim is supported, partially. Please send bounce messages from your busted MTA, I'll extend the class to support them. It can extract the the address of the recipient that bounced as well the mail server response status code.
http://anti-spam-man.com/php_bouncehandler/
118 stars 72 forks source link

How to get the email text #8

Open glena opened 10 years ago

glena commented 10 years ago

Hi, we are trying to implement your class in our code to check bounces but we are getting the following error:

0 /vagrant/leads/cron/bounce/bounce_driver.class.php(500):

1 /vagrant/leads/cron/bounce/bounce_driver.class.php(431): BounceHandler->standard_parser

2 /vagrant/leads/cron/bounce/bounce_driver.class.php(107): BounceHandler->parse_head

3 /vagrant/leads/cron/bouncemailparser.php(36): BounceHandler->get_the_facts

4 /vagrant/leads/cron/bouncemailparser.php(74): BounceMailParser->run

To get the emails we are using imap_open in the following way:

$conn = imap_open($host, $user, $pass, OP_SILENT) or die(imap_last_error());

$num_msgs = imap_num_msg($conn); $email_addresses = array(); $delete_addresses = array(); for($n = 1; $n <= $num_msgs; $n++) { $bounce = imap_fetchheader($conn, $n) . imap_body($conn, $n); //entire message $multiArray = $bouncehandler->get_the_facts($bounce); }

cfortune commented 10 years ago

//To feed the parser a properly formatted MIME email, make sure there is a double line return between the header and body.
$bounce = imap_fetchheader($conn, $n) . "\r\n" . "\r\n" . imap_body($conn, $n); //entire message

glena commented 10 years ago

No, still the same (I replace my line with yours). Is there a better way to get the emails than imap_open that works better with your class?

cfortune commented 10 years ago

That should have worked. You should examine the contents of the $bounce variable to see where it went wrong.

You will need to start with a plain text email. Each and every email is saved as a file on the mail server. Talk with your server admin about how to access those files.

glena commented 10 years ago

I will check this variable. The issue is that we are using google apps :(

Germán Lena

Sent from my mobile. Please excuse the brevity, spelling and punctuation. El feb 8, 2014 8:13 PM, "cfortune" notifications@github.com escribió:

That should have worked. You should examine the contents of the $bounce variable to see where it went wrong.

You will need to start with a plain text email. Each and every email is saved as a file on the mail server. Talk with your server admin about how to access those files.

— Reply to this email directly or view it on GitHubhttps://github.com/cfortune/PHP-Bounce-Handler/issues/8#issuecomment-34559586 .