Discussion:
SendFailedException: distinguishing invalid sender from invalid recipient
Boris Burtin
2008-12-11 22:03:49 UTC
Permalink
Is there a way to distinguish an invalid sender from an invalid recipient
when a SendFailedException is thrown? When the sender is rejected, getInvalidAddresses()
for the top-level SendFailedException returns the *recipients*, not the sender.
Then there's a chained SendFailedException that has the invalid sender.

Is this correct? Seems funky to return the recipients as invalid when the
sender is the problem. Is it reliable to assume that the sender is bad if
a chained SendFailedException exists?

Thanks in advance,

Boris

===========================================================================
To unsubscribe, send email to ***@java.sun.com and include in the body
of the message "signoff JAVAMAIL-INTEREST". For general help, send email to
***@java.sun.com and include in the body of the message "help".
Bill Shannon
2008-12-11 22:48:57 UTC
Permalink
Post by Boris Burtin
Is there a way to distinguish an invalid sender from an invalid recipient
when a SendFailedException is thrown? When the sender is rejected, getInvalidAddresses()
for the top-level SendFailedException returns the *recipients*, not the sender.
Then there's a chained SendFailedException that has the invalid sender.
Is this correct? Seems funky to return the recipients as invalid when the
sender is the problem. Is it reliable to assume that the sender is bad if
a chained SendFailedException exists?
Hmmm... Good point.

I'm surprised you're getting any chained exception at all, and I'm surprised
you're getting any information about the sender, unless the sender is also a
recipient.

Are you using JavaMail 1.4.1?

From looking at the code, I would expect a single SMTPSendFailedException
with all the addresses listed as valid unsent. The only way to determine
that it's the sender's address that failed is to look at the command saved
in the SMTPSendFailedException to see if it's a "MAIL" command.

There should probably be a special exception to report this failure.

Can you reproduce this using the smtpsend.java demo program, run with
the -d option, and send me the output?

===========================================================================
To unsubscribe, send email to ***@java.sun.com and include in the body
of the message "signoff JAVAMAIL-INTEREST". For general help, send email to
***@java.sun.com and include in the body of the message "help".
Loading...