javax.mail.Transport.send0() 没有抛出它承诺的异常
javax.mail.Transport.send0() not throwing the exceptions it's promising
当我向虚假域发送电子邮件时,说 test@rstjhajh.com
,我正在接收 电子邮件 到发件人地址,邮件正文:
The following message to <test@rstjhajh.com> was undeliverable.
The reason for the problem:
5.1.2 - Bad destination host 'DNS Hard Error looking up rstjhajh.com (MX): NXDomain'
和一个附件
Reporting-MTA: dns; ironport2-out.teksavvy.com
Final-Recipient: rfc822;test@rstjhajh.com
Action: failed
Status: 5.0.0 (permanent failure)
Diagnostic-Code: smtp; 5.1.2 - Bad destination host 'DNS Hard Error looking up rstjhajh.com (MX): NXDomain' (delivery attempts: 0)
Transport.send()
不会 抛出任何异常。
这怎么可能???一个天真的问题,但浪费了我的时间,就在那里。
TIA。
//============
编辑:
rstjhajh.com
不是已注册的 DNS 服务器。没有电子邮件服务器可以接受和握手 - 当我在 DNS 上查找它时,我得到 NamingException
。 "door" Transport.send()
交付给谁??
发生这种情况是因为邮件是一种异步协议。 Transport.send()
如果电子邮件无法发送到邮件服务器或邮件服务器拒绝它(例如未知主机),则抛出异常。
这里发生的事情是电子邮件被正确发送到(并被)邮件服务器接收,但是由于电子邮件地址不存在,服务器无法投递它。
您不能依赖 Transport.send()
抛出异常来确定您发送的电子邮件是否已正确送达。唯一的方法是检查用于发送它的地址是否有未送达的消息。
当我向虚假域发送电子邮件时,说 test@rstjhajh.com
,我正在接收 电子邮件 到发件人地址,邮件正文:
The following message to <test@rstjhajh.com> was undeliverable.
The reason for the problem:
5.1.2 - Bad destination host 'DNS Hard Error looking up rstjhajh.com (MX): NXDomain'
和一个附件
Reporting-MTA: dns; ironport2-out.teksavvy.com
Final-Recipient: rfc822;test@rstjhajh.com
Action: failed
Status: 5.0.0 (permanent failure)
Diagnostic-Code: smtp; 5.1.2 - Bad destination host 'DNS Hard Error looking up rstjhajh.com (MX): NXDomain' (delivery attempts: 0)
Transport.send()
不会 抛出任何异常。
这怎么可能???一个天真的问题,但浪费了我的时间,就在那里。
TIA。
//============
编辑:
rstjhajh.com
不是已注册的 DNS 服务器。没有电子邮件服务器可以接受和握手 - 当我在 DNS 上查找它时,我得到 NamingException
。 "door" Transport.send()
交付给谁??
发生这种情况是因为邮件是一种异步协议。 Transport.send()
如果电子邮件无法发送到邮件服务器或邮件服务器拒绝它(例如未知主机),则抛出异常。
这里发生的事情是电子邮件被正确发送到(并被)邮件服务器接收,但是由于电子邮件地址不存在,服务器无法投递它。
您不能依赖 Transport.send()
抛出异常来确定您发送的电子邮件是否已正确送达。唯一的方法是检查用于发送它的地址是否有未送达的消息。