SendFailedException, invalid addresses, and lifetime of Transportdata

S

Steve

I have a mail sender program that sends emails to a mailing list. When
I send a message to one of the servers we use, it seems that one
SendFailedException for an invalid address kills the whole list.
(because getting the unsent valid addresses shows the remainder of the
list, and also because I didn't get the message anywhere).

Am I actually supposed to put the whole thing in a loop, go back to my
list and remove the invalid address that were returned, and then try again?

That concerns me, because sometimes I get addresses in the valid unsent
list that weren't in this message -- they were addresses in some earlier
attempt that failed. Which makes me wonder if whatever Transport
connects to buffers that info, making it persist somehow into a
different session.
 
D

Daniel Pitts

Steve said:
I have a mail sender program that sends emails to a mailing list. When
I send a message to one of the servers we use, it seems that one
SendFailedException for an invalid address kills the whole list.
(because getting the unsent valid addresses shows the remainder of the
list, and also because I didn't get the message anywhere).

Am I actually supposed to put the whole thing in a loop, go back to my
list and remove the invalid address that were returned, and then try again?

That concerns me, because sometimes I get addresses in the valid unsent
list that weren't in this message -- they were addresses in some earlier
attempt that failed. Which makes me wonder if whatever Transport
connects to buffers that info, making it persist somehow into a
different session.

First, I would validate addresses before-hand if possible. Second, it
sounds like a somewhat broken server. I would look into configuring the
server to handle this problem differently or look into another server,
depending on your options.

Other than that, I don't know what to tell you, without more explicit
details on the error message and code used.

Good Luck,
Daniel.
 
S

Steve

I'm validating the addresses for general format first, but don't know
any way to validate them for existence other than to send a message.

The whole problem came up because Verizon doesn't seem to be able to do
whatever is necessary to keep themselves from being blacklisted by the
server we use. So, I modified my sender to separate the Verizon
addresses from the rest (into two ArrayLists, which I then get the
InternetAddress arrays from), and, for the Verizon group, send the mail
through their server rather than through the local one (all the rest go
through the server for my site). But, on the Verizon server, they must
validate that the address actually exists before sending the mail
through. And, the annoying aspect is that the whole send fails, rather
than just those addresses. So now I put it in a loop, scoop the bad
addresses from the exception, remove them from the ArrayList, and try again.

I got the whole process to work in a pretty kludgy way. But, for some
reason, after doing all that, the half that uses my home server now
takes about 90 seconds to do the Transport.send, as opposed to the
second or so that the original version took.

Steve
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top