Can't get Email to work

1 message Options
Embed this post
Permalink
KellyBalthrop

Can't get Email to work

Reply Threaded More More options
Print post
Permalink
I'm working with nLog for the first time and all's well except for Email.  For some reason I can't get it to send Email.  My environment is .net 3.5, Visual Studio 2008, client server.  Is there anything in the way the target or rules are set up that could be giving me problems.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
    </configSections>
    <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

        <targets>
            <target
                    name="Errors" xsi:type="EventLog" layout="${longdate} ${logger}: ${message}"
                    source="My Source" log="Application"/>
            <target
                    name="Info" xsi:type="File"
                    layout="${longdate} ${logger}: ${message}"
                    fileName="${basedir}/${shortdate}/${windows-identity:domain=false}.${level}.log"/>
            <target
                    name="Msgbox" xsi:type="MessageBox" layout="${message}"
                    caption="${level}"/>
            <target
                    name="Mail" xsi:type="Mail" smtpServer="mailserver.com"
                    from="xxx@mailserver.com" to="xxx@mailserver.com"
                    subject="${longdate} ${logger}: ${message}"/>
        </targets>
        <rules>
            <logger name="*" level="Warn" writeTo="Errors,Mail"/>
            <logger name="*" level="Error" writeTo="Errors,Mail"/>
            <logger name="*" level="Fatal" writeTo="Errors,Mail"/>
            <logger name="*" level="Info" writeTo="Info"/>
            <logger name="*" levels="Trace,Debug" writeTo="Msgbox"/>
        </rules>
    </nlog>

</configuration>