Email Delivery Failures .

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rameshmrgn
Forum Newbie
Posts: 15
Joined: Sat Jun 17, 2006 1:01 am

Email Delivery Failures .

Post by rameshmrgn »

Hi all,

Is it, possible to detect Email Delivery Fialures from our server side Script?

I want to count the No. of failure deliveries for a particular Email ID.

Any one plz....


Smiles,
Ramesh Muru.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

You need to set a return-path (bounce-detect) address and monitor it for bounces.

Using Swift Mailer: http://www.swiftmailer.org/wikidocs/v3/ ... ce_address

There are examples for how to do it with mail() in the PHP Manual.
rameshmrgn
Forum Newbie
Posts: 15
Joined: Sat Jun 17, 2006 1:01 am

hi

Post by rameshmrgn »

Thanks for your timely reply....

i would like to update my database automaticaly while Mail failure delivery acquire instead of sending failure mail status to some other Email ID...

is it possible?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: hi

Post by Chris Corbyn »

rameshmrgn wrote:Thanks for your timely reply....

i would like to update my database automaticaly while Mail failure delivery acquire instead of sending failure mail status to some other Email ID...

is it possible?
It's not possible to do at the exact same time you send no. You may have to wait up to 72 hours. You can write scripts to pick up the bounced emails though; it doesn't have to be done by a human.
rameshmrgn
Forum Newbie
Posts: 15
Joined: Sat Jun 17, 2006 1:01 am

hi

Post by rameshmrgn »

could u help me write script to pick up the bounced emails though?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: hi

Post by Chris Corbyn »

rameshmrgn wrote:could u help me write script to pick up the bounced emails though?
Not really no sorry, I'm too busy, but I can give you some hints.

(Assuming you don't have access the MX server config)

You need to use the IMAP functions or PEAR::IMAP to read the mailbox. Open the mailbox, look for messages that haven't been read, run some regex on the body to determine if you need to mark an email address as unusable. You may even need to run regex on the subject line/headers since you could potentially be wasting resources inspecting SPAM/Junk emails.

There's no "standard" bounce message so just collect as many different ones as you can and add the different strategies (in code) for reading them.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

One more thing.. in some cases when you try to send an email to someone your STMP server will fail (if there was no mailbox for the account for example, or if the user's mailbox is full). You should examine your mail logs as well if you're trying to ascertain whether an email was sent and/or received. Checking an return account for bounced emails will only tell you if the mail was sent but returned for some reason. Examining the mail logs, especially the SMTP return code, will tell you more. You really need to do both.

It's not easy of course, and how you do it depends entirely on your server set up.
Post Reply