How do I email errors logged with NLog? [closed]

醉酒当歌 提交于 2019-12-02 20:11:02

Change your encoding from UTF8 to UTF-8.

Assuming there are no other errors in your SMTP settings (which is usually the cause of messages not being sent), it should work.

I think you need to setup the mailSettings in the system.net. Something like this:

<system.net>
  <mailSettings>

    <smtp from="someone@someone.org">
      <network host="server.net" userName="someone@someone.org" password="somepassword"/>
    </smtp>

    <!--Just and example of for testing. Cant have both-->
    <smtp deliveryMethod="SpecifiedPickupDirectory" from="someone@someone.org">
      <network host="localhost"/>
      <specifiedPickupDirectory pickupDirectoryLocation="d:\tmp\email"/>
    </smtp>

  </mailSettings>
</system.net>

First option is for using the SMTP server and second to deliver email to your local folder. Second option is good for testing.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!