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
Juha Laiho - 24 Jan 2006 16:21 GMT
matthewjbarr@gmail.com 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.

Signature
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
matthewjbarr@gmail.com - 24 Jan 2006 16:26 GMT
Roedy Green - 24 Jan 2006 18:53 GMT
>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.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.