Bounce Email handling with PHP?

56,658

Solution 1

The best scenario is be able to classify the type of bounce: soft, hard...

what we use is BounceStudio. You need to compile it and add the php libraries... not hard at all. You have the free and paid version of that product

once we detect the kind of bounce we use PEAR::MAIL::MIME to search for custom headers that we added previously to the email, lets say:

X-user-id: XXXXX
X-campaign-id: YYYYYY 
X-recipient-id: SSSSSSSSS

in this way we can know the real recipient that we sent the email to.

hope this help you! so you can help me to get to the 500 points :P

Solution 2

Why not create a [email protected] and use php to read those emails and do what ever you want?

Edit After your comment : Please chec my link whcih has a php script which will teach you how to open and email box using php and read the emails. You can use this scrip to check the error messages.

Solution 3

Let the emails bounce to an address that is really an emailadress (with login details etc.).

Make a php script which runs ever x minutes (for example with a cron job). This php script must do the following. - Retrieve all email from the box (use for example Zend Mail) - Check for the error in the message (e.g. by searching it with regular expressions) - Do what ever is necessary.

If you want to know specifically who has bounced back you can use user specific bounce addresses. (See for example this site)

Solution 4

Maybe it's a little late for the answer, but you can always try something new. I had the last week a task like this, and used BOUNCE HANDLER Class, by Chris Fortune, which chops up the bounce into associative arrays - http://www.phpclasses.org/browse/file/11665.html

This will be used after you connect to the POP3 with some mailer to get the bounces from it, then parse it into pieces with this, and if has the status you searched for, do the necessary actions.

Cheers.

Solution 5

If you've got a POP3 mailbox set up for [email protected], you could use a POP3 client script written in PHP to retrieve the messages and check for undeliverable messages.

Share:
56,658
Admin
Author by

Admin

Updated on July 15, 2022

Comments

  • Admin
    Admin almost 2 years

    Here is my scenario:

    I have 2 email accounts: [email protected] and [email protected].

    I want to send email to all my users with [email protected] but then "reply to" [email protected] (until here, my PHP script can handle it).

    When, the email can't be sent, it's sent to [email protected], the error message could be 553 (non existent email ...) etc.

    My question is: How do I direct all those bounce emails (couldn't-sent emails) to [email protected] through a handling script to check for the bounce error codes?

    What programming language should I be using for the "handling script"?

    What would the "handling script" look like? Can you give a sample?

    in other words:

    What are the procedures I should follow to handle the bounce email ?