Sending SMTP mail when SMTP server is unavailable

M

matthewjbarr

Hi,

We're using the Java mail API to send simple emails from our system via
the company's Exchange server, which works just fine. However, we'd
like to know what happens if the SMTP server is down, and whether there
is a technique available to queue the sent messages in the event of the
SMTP service being unavailable, so that they may be resent at a later
date.

Any ideas?

Thanks,

Matt
 
J

Juha Laiho

(e-mail address removed) said:
We're using the Java mail API to send simple emails from our system via
the company's Exchange server, which works just fine. However, we'd
like to know what happens if the SMTP server is down, and whether there
is a technique available to queue the sent messages in the event of the
SMTP service being unavailable, so that they may be resent at a later
date.

If it's your application that is directly using the Java Mail API,
then you are apparently calling an implementation of
javax.mail.Transport.send() . This is documented to throw
javax.mail.SendFailedException if sending the message does not
succeed for some reason. So, to recover from this, you catch this
exception, and write logic in your application to handle queuing the
message.

So, the Java Mail API does not provide any queuing mechanism; if
you need one, you'll need to implement it.
 
R

Roedy Green

We're using the Java mail API to send simple emails from our system via
the company's Exchange server, which works just fine. However, we'd
like to know what happens if the SMTP server is down, and whether there
is a technique available to queue the sent messages in the event of the
SMTP service being unavailable, so that they may be resent at a later
date.

the easiest way to handle it would be to run your own local
mailserver. That's what they are for, queuing mail to send and
receive.
 

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,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top