dcsimg
How to detect an undeliverable message from the stream of messages recieved?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   amr_zaki
Posted On:   Sunday, May 18, 2003 09:30 AM

Hi Sir, I am involved in an application that use JAVAMAIL extensively . I wish to have your support so soon regarding the following question:- I am building an application that sends batch emails (newsletter) which are stored in DB , some of such emails addresses may be correct , others not correct . I want for the received email to detect the followings :- 1) Ordinary response (manual response) 2) Undeliverable (due to error from the mailserver) After I receive such emails , I will change the new email status in the DB. Note: I do want to depend my decision on the some SMTP data in the email , for example : Example Undeliverab   More>>

Hi Sir,

I am involved in an application that use JAVAMAIL extensively .

I wish to have your support so soon regarding the following question:-

I am building an application that sends batch emails (newsletter) which are stored in DB , some of such emails addresses may be correct , others not correct .



I want for the received email to detect the

followings :-

1) Ordinary response (manual response)

2) Undeliverable (due to error from the mailserver)


After I receive such emails , I will change the new email status in the DB.

Note: I do want to depend my decision on the some SMTP data in the email , for example :
Example Undeliverable Mail Notification Message as SMTP dialog



S: MAIL FROM: <>

R: 250 ok

S: RCPT TO: <@HOSTX.ARPA:JOE@HOSTW.ARPA>

R: 250 ok

S: DATA

R: 354 send the mail data, end with .

S: Date: 23 Oct 81 11:22:33

S: From: SMTP@HOSTY.ARPA

S: To: JOE@HOSTW.ARPA

S: Subject: Mail System Problem

S:

S: Sorry JOE, your message to SAM@HOSTZ.ARPA

lost.

S: HOSTZ.ARPA said this:

S: "550 No Such User"

S: .

R: 250 ok






Note the "550 No Such User" !!

How can I use javamail to detect “undeliverable” mails for example ?

If you would please write me the code to do that .

I wish to reply to me soon.

Thanks in advance ,


Eng. Amr Zaki (Systems Architect)
NileSoft International (www.nilesoft.net)
mailto:amr.zaki@nilesoft.net

   <<Less

Re: How to detect an undeliverable message from the stream of messages recieved?

Posted By:   Christopher_Koenigsberg  
Posted On:   Sunday, May 18, 2003 05:43 PM

What you ask is a very hard problem, and I don't know of anyone who has ever written the code to "do it right". (maybe my experience is out of date by now though; have you Googled for this yet?)



If you only deal with very well-behaved mailers, your task is easier, but the pathological cases will drive you crazy.



You can study the RFC's for standard classes of numerical error codes in the SMTP dialog e.g. your "550" error. Then you can study the RFC's for standard DSN formats (Delivery Status Notification).



And you may be able to write code to handle most common errors from well-behaved mailers, as I said, either in the SMTP dialog itself, or in the DSN's returned to you eventually/hopefully by remote mailers (once you've gained experience enough, and have collected enough bounced errors etc., to see which are the most common ones, from the mailers you mostly have to deal with given your particular audience of recipients).



Remember also that any one of the MTA's (Mail Transfer Agents, mailers e.g. SMTP servers), along the chain to your destination, may experience a problem completing the SMTP transmission to the next one in the chain, and may retry for perhaps like 5 days, before permanently giving up. So you may continue to get bounces from retries for days and days afterwards, on a particular message, and sometimes it is very hard to identify the original message that caused the retries. The worst cases are crappy proprietary mail gateways (like old Microsoft Mail, QuickMail etc.), and/or X.400 gateways. Also some of the worst cases come from complicated situations when someone has their mail aliased, forwarded, re-sent etc., off to some other set of addresses or mailing list, and one of them bounces, and the bounces don't contain the original destination address, etc. etc..



Everybody I've ever heard of, working on mail systems, has had to hack their own, to take care of the cases/examples they are familiar with, from their experience, from their own accumulated collection of bounced errors etc. and as I said, my experience is some years out of date so the worst of the older mailers may have been mostly retired/phased out by now (at least you won't have to deal with CSNet, BITNet, UUCP etc. relays anymore, hopefully), but I don't know what kinds of nasty new ones are out there...



Perhaps a neural network would be a new way to approach this problem, and "train" it on a large collection of different kinds of errors which you have parsed and classified by hand, in advance.

About | Sitemap | Contact