How do I email errors logged with NLog?
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="[email protected]">
<network host="server.net" userName="[email protected]" password="somepassword"/>
</smtp>
<!--Just an example for testing. Can't have both-->
<smtp deliveryMethod="SpecifiedPickupDirectory" from="[email protected]">
<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.