Bounce Email handling with PHP?

mcfadder_09 picture mcfadder_09 · Jun 18, 2009 · Viewed 55.7k times · Source

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 ?

Answer

Gabriel Sosa picture Gabriel Sosa · Jun 18, 2009

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