Is Javamail asynchronous or synchronous? That is, if I send off an email, do I continue processing immediately afterwards, or do I wait until it's complete?
Furthermore, are there any ways that I could catch that an email failed to be delivered for any reason?
I'd also like to know these answers for Spring's MailSender abstraction.
Thanks.
The JavaMail is an API that is used to compose, write and read electronic messages (emails). The JavaMail API provides protocol-independent and plateform-independent framework for sending and receiving mails.
SMTP– Simple Mail Transfer Protocol is used for sending e-mails. POP3– Post Office Protocol is used to receive e-mails. It provides one to one mapping for users and mail boxes, which is one mail box for one user. IMAP– Internet Message Access Protocol is also used to receive e-mails.
SMTP is an acronym for Simple Mail Transfer Protocol. It is an Internet standard for electronic mail (e-mail) transmission across Internet Protocol (IP) networks.
It is synchronous, since it transfers the message to the server and processes the server's response before returning. The send
docs explain in further detail. The message will throw a SendFailedException
, or another MessagingException
,
if the send fails immediately. But "success does not imply that the message was delivered to the ultimate recipient, as failures may occur in later stages of delivery."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With