views:

3446

answers:

6

I am really new to this (not new to php).

Here is my scenario:

I have 2 emails 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 cant be sent, it 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 for the "handling script"?

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

OR:(Big Question)

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

+1  A: 

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.

Shoban
u mean, i create a directory, store all emails for [email protected]. Then, write a php script, check that folder periodically and check for error code?
no... create a new id [email protected] . Supply the email details to php script and make it run periodically using a cron. PHP can be used to open pop 3 accounts (check above code). There is no need to store emails. Your script should acutomaticaly open the mailbox and process new emails.
Shoban
Thats why I need a procedures, i am totally new to handle this bounce email thing. I cant even where to start, how to "supply email details to php script"? I need help... help... me...
You said you are not new to php.. Did you ever check the link I posted? Check the php code in the link and ask any specific doubt in it. All you have to give is the email id, port details etc.
Shoban
+1  A: 

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.

Kev
Sory, this is out of my option.. i really dunno where to start with..
+2  A: 

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)

Peter Smit
+3  A: 

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

Gabriel Sosa
A: 

Hi,

Your have to set the reply-to to the bouncemail id in the header before sending the mails.

Thanks & Regards, Satya. www.inetminds.com

Satya
A: 

You should look at SwiftMailer. It's completely written in PHP and has support for "bounce" emails. http://swiftmailer.org/

Brent Baisley