Javamail是异步的还是同步的?
Javamail是异步的还是同步的?也就是说,如果我发送电子邮件,我是立即继续处理,还是等到它完成?
此外,有什么方法可以让我发现电子邮件因任何原因未能发送?
我还想知道 Spring 的 MailSender 抽象的这些答案。
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它是同步的,因为它将消息传输到服务器并在返回之前处理服务器的响应。
发送
文档有更详细的解释。该消息将抛出SendFailedException
或另一个MessagingException
,如果发送立即失败。但“成功并不意味着消息已传递给最终收件人,因为在传递的后期阶段可能会发生失败。”
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 aSendFailedException
, or anotherMessagingException
,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."