c# - NLog Mail target timeouts -
i'm trying use nlog's mail target send emails through secured (ssl) smtp server. here configuration:
<target type="mail" name="mailtarget" layout="${message}" encoding="utf-8" html="false" addnewlines="false" subject="hi8766" to="ben.g@mycompany.com" from="ben.g@mycompany.com" body="${message}" smtpusername="ben.g" enablessl="true" smtppassword="12345" smtpauthentication="basic" smtpserver="smtp.mycompany.com" smtpport="465" deliverymethod ="network" pickupdirectorylocation="" timeout="20000"/>
however when use logger.info(message)
nothing happens. turned on nlog's internal logging on , started wireshark, on internal logs see:
2016-02-05 10:46:54.3968 debug sending mail ben.g@mycompany.com using smtp.mycompany.net.il:465 (ssl=true) 2016-02-05 10:47:14.4526 error system.net.mail.smtpexception: operation has timed out. @ system.net.mail.smtpclient.send(mailmessage message) @ nlog.internal.mysmtpclient.nlog.internal.ismtpclient.send(mailmessage ) @ nlog.targets.mailtarget.processsinglemailmessage(list`1 events)
the thing can see syn-syn/ack-ack transmission ssl negotiation doesn't start , stops untill fin client. weird because have compared network behavior outlook on same setting , ssl start , works fine , email sent.
this .net bug, described at: http://blogs.msdn.com/b/webdav_101/archive/2008/06/02/system-net-mail-with-ssl-to-authenticate-against-port-465.aspx
tl;dr: ssl + port 465 (implicit ssl) not supported in .net. can use ssl + port 25 (explicit ssl)
there github issue this. if can build workarounds in nlog this, let know.
Comments
Post a Comment