我试图使用NLog的邮件目标通过安全(SSL)smtp服务器发送电子邮件。这里是我的配置:NLog邮件目标超时
<target type="Mail"
name="MailTarget"
layout="${message}"
encoding="UTF-8"
html="False"
addNewLines="False"
subject="hi8766"
to="[email protected]"
from="[email protected]"
body="${message}"
smtpUserName="ben.g"
enableSsl="True"
smtpPassword="12345"
smtpAuthentication="Basic"
smtpServer="smtp.MyCompany.com"
smtpPort="465"
deliveryMethod ="Network"
pickupDirectoryLocation=""
timeout="20000"/>
但是,当我使用logger.info(message)
什么也没有发生。我在打开NLOG的内部记录,并也开始Wireshark的,在内部日志我看到:
2016-02-05 10:46:54.3968 Debug Sending mail to [email protected] using smtp.MyCompany.net.il:465 (ssl=True)
2016-02-05 10:47:14.4526 Error System.Net.Mail.SmtpException: The operation has timed out.
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at NLog.Internal.MySmtpClient.NLog.Internal.ISmtpClient.Send(MailMessage)
at NLog.Targets.MailTarget.ProcessSingleMailMessage(List`1 events)
的事情是,我可以看到SYN-SYN/ACK-ACK透射,但随后SSL 谈判没有按”开始,一切都会停止,直到客户端的FIN。这很奇怪,因为我已经将网络行为与相同设置的outlook进行了比较,并且ssl确实启动并且一切正常并发送了电子邮件。
有时还是总是?对我来说这是有时和 我增加超时,它的工作... – Raghavendra