java mail handling bounced messages

A

ameyas7

hi all,

i am using java mail for sending mails using SMTP server.
is there anyway by which i (my application) can get to know if the
mail bounced ?
is there any synchronous call which will let me know immidiately if
the mail bounced for a particular mail address (in case there are
multiple recepients).

i am aware that i can provide reply path but how does my application
come to know if the mail bounced / failed.

how is this generally taken care of ?

thanks

regards
amey
 
A

Andrew Thompson

ameyas7 wrote:
...
is there any synchronous call which will let me know immidiately if
the mail bounced for a particular mail address (in case there are
multiple recepients).

Many mail networks nowadays will refuse to acknowledge
whether any particular email address is valid, especially to
avoid encouraging spam email to multiple recipients.

The attitude is - if a sender does not know whether an
email address exists, they should not be sending email
to it, in the first place.

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200708/1
 
A

ameyas7

Hi Andrew,
The attitude is - if a sender does not know whether an
email address exists, they should not be sending email
to it, in the first place.

hmm but mail may bounce for several reasons.
say in an organisation which puts a max mailbox size limit on the
employee.
so if he is on longggggggggg vacation ;) maybe his box gets full.
so even though the recepient is valid, mail may bounce.

i wanted to know if there is any mechanism by which i will get to know
if the mail was successfully delivered (from my application).

thanks
amey
 
S

shakah

Hi Andrew,


hmm but mail may bounce for several reasons.
say in an organisation which puts a max mailbox size limit on the
employee.
so if he is on longggggggggg vacation ;) maybe his box gets full.
so even though the recepient is valid, mail may bounce.

i wanted to know if there is any mechanism by which i will get to know
if the mail was successfully delivered (from my application).

thanks
amey

As another poster suggested, the best answer to your question is
"maybe", depending on the destination mail server's configuration. In
the best case for you, the server "bounces" the message for any of
several reasons by sending an e-mail to one of:
1. the mail header's "Sender" address
2. the SMTP conversation's "From" address
3. the mail header's "Reply-To" address

Given that, your application can periodically check a mailbox for such
bounced messages, and try to correlate it with an e-mail that you
sent. Note that this "negative ACK" covers your original question
("how can I know if it bounced"), but not your most recent version of
"how can I know if it was successfully delivered" variation (which
would need a "positive ACK").
 
G

Greg R. Broderick

hi all,

i am using java mail for sending mails using SMTP server.
is there anyway by which i (my application) can get to know if the
mail bounced ?
is there any synchronous call which will let me know immidiately if
the mail bounced for a particular mail address (in case there are
multiple recepients).

A sent mail may 'bounce' in one of two ways:

1. the SMTP server to which you (the mail user agent/mail client) are
sending the mail may reject the message either temporarily or permanently.
This is handled with an SMTP result code of 4xx (temporary failure) or 5xx
(permanent failure), where the precise reasoning for the failure can be
determined from the other two digits of the result code. Consult RFC 2821
for the gory technical details of SMTP response codes. You may detect and
trap these in the sending SMTP client software immediately when the message
is sent -- this provides a synchronous feedback when the message is
immediately rejected.

2. SMTP and the Internet mail architecture is, by design, store-and-forward
-- you send a message to an intermediate host (your ISP's mail server) which
stores the message and forwards it on to another intermediate host, until it
eventually reaches the recipient. This storage and forwarding happens after
the initial sending of the message from the mail client to the mail server
has completed successfully, thus no synchronous means is available to notify
the mail client that the message has been rejected or bounced by one of the
intermediate hosts. What most mail servers will do is to return an email
message to the putative sender's email box, containing an error message,
indicating why the message failed to be sent, and possibly the original
message. This message may be retrieved from the sender's email box using
whatever method (usually POP3 or IMAP) the mail client normally uses to
retrieve inbound email messages.

Due to the nature of SMTP as a store-and-forward mail system, this can not
happen synchronously, thus no synchronous feedback is possible when one of
the intermediate hosts further down the line rejects the sender's email.

For more information, please consult the various Internet RFCs concerning
email and SMTP.


Cheers!
GRB

--
---------------------------------------------------------------------
Greg R. Broderick (e-mail address removed)

A. Top posters.
Q. What is the most annoying thing on Usenet?
---------------------------------------------------------------------
 
R

Roedy Green

i am aware that i can provide reply path but how does my application
come to know if the mail bounced / failed.

I handle the problem by doing checking ahead of time that at least the
mailserver exists and has been alive some time in recent memory.
I use a "analog" measure of email address plausibility, so you can
filter out email addresses that are likely duds.
See http://mindprod.com/products1.html#BULK

The bounces come back later an wide variety of formats. Perhaps you
could write a JavaMail program to comb through these looking for
headers, or text that indicates a bounce.
 
A

ameyas7

.........
The bounces come back later an wide variety of formats. Perhaps you
could write a JavaMail program to comb through these looking for
headers, or text that indicates a bounce.


thanks roedy.


- amey
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top