I'm looking to extend NLog's MailTarget
because we wish to hide our user name and password from the NLog.config
file because it is distributed to all of our clients.
Here is what I have:
[Target("HiddenPasswordMail")]
public class HiddenPasswordMailTarget : MailTarget
{
public HiddenPasswordMailTarget()
{
SmtpUserName = "USERNAME";
SmtpPassword = "PASSWORD";
SmtpServer = "SMTPSERVER";
}
}
NLog.config
<target xsi:type="HiddenPasswordMail"
name="EmailLog"
subject="${level} on ${machinename}"
to="TOADDRESS"
from="FROMADDRESS"
body="${longdate}|${level:uppercase=true}|${logger}|${message}" />
The issue is that while I can see that my username, password and server address have all been set, no email is actually sent. How can I debug this?
Are there perhaps any alternatives to this? I've tried configuring NLog through code but there appears to be missing features that are available with the XML configuration.