title: Log4Net SmtpAppender for WebEmail - Not Sending
body: <p>I'm trying to get Log4Net working with web email, either Yahoo or Gmail.  If you have this working, I would appreciate some help, and thanks in advance.</p>
  
  <p>I've got a default root logger, with a RollingFileAppender and an SmtpAppender.
  The file appender is working fine.  The SmtpAppender is giving me nothing.</p>
  
  <p>I am calling the logger from a diagnostic button click... </p>
  
  <pre class="lang-cs prettyprint-override"><code>protected void btnReloadContractConfig_Click(object sender, EventArgs e)
  {
      // DIAGNOSTIC - Test email logger
      log4net.ILog logger = log4net.LogManager.GetLogger("root");
      logger.Error("btnReloadContractConfig_Click() - This is a TEST of delivery of error messages via email, triggered from the Admin.aspx.cs code file.");
  }
  </code></pre>
  
  <p>...and the RollingFileAppender is getting the message...</p>
  
  <p>LOC=20120921-12:03:16.319,UTC=20120921-11:03:16.319,DELTA=10078,THR=6,ERROR,LOG=root,[(null)] - btnReloadContractConfig_Click() - This is a TEST of delivery of error messages via email, triggered from the Admin.aspx.cs code file.</p>
  
  <p>The web.config entries for Log4Net are here::</p>
  
  <pre class="lang-xml prettyprint-override"><code>  &lt;appSettings&gt;
      &lt;add key="log4net.Internal.Debug" value="true"/&gt;        
    &lt;appSettings&gt;
  
  
    &lt;log4net 
      xsi:noNamespaceSchemaLocation="http://csharptest.net/downloads/schema/log4net.xsd" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
      &lt;root&gt;
        &lt;level value="DEBUG" /&gt;
        &lt;appender-ref ref="LogFileAppender" /&gt;
        &lt;appender-ref ref="SmtpAppender" /&gt;
      &lt;/root&gt;
  
      &lt;appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender"&gt;
        &lt;file value="MiniMkt01Log.txt"/&gt;
        &lt;!-- &lt;file value="${TMP}\log-file.txt" /&gt; --&gt;
        &lt;appendToFile value="true" /&gt;
        &lt;rollingStyle value="Size" /&gt;
        &lt;maxSizeRollBackups value="10" /&gt;
        &lt;maximumFileSize value="10MB" /&gt;
        &lt;staticLogFileName value="true" /&gt;
        &lt;layout type="log4net.Layout.PatternLayout" &gt;
      &lt;header value="[Header]&amp;#13;&amp;#10;" /&gt;
      &lt;conversionPattern value="LOC=%date{yyyyMMdd-HH:mm:ss.fff},UTC=%utcdate{yyyyMMdd-HH:mm:ss.fff},DELTA=%timestamp,THR=%thread,%-5level,LOG=%logger,[%property{NDC}] - %message%newline" /&gt;
        &lt;/layout&gt;  
      &lt;/appender&gt;
  
      &lt;appender name="SmtpAppender" type="log4net.Appender.SmtpAppender"&gt;
        &lt;to value="FacelessDevTeam@yahoo.com" /&gt;
        &lt;from value="hiblet@yahoo.com" /&gt;
        &lt;subject value="Logging Message" /&gt;
        &lt;smtpHost value="smtp.yahoo.com" /&gt;
        &lt;port value="25"/&gt;
        &lt;authentication value="Basic" /&gt;
        &lt;username value="FacelessDevTeam@yahoo.com"/&gt;
        &lt;password value="?????[real password hidden for obvious reasons]"/&gt;
        &lt;!-- &lt;EnableSsl value="true" /&gt; --&gt;
        &lt;bufferSize value="10" /&gt;
        &lt;lossy value="true" /&gt;
        &lt;evaluator type="log4net.Core.LevelEvaluator"&gt;
      &lt;threshold value="WARN"/&gt;
        &lt;/evaluator&gt;
        &lt;layout type="log4net.Layout.PatternLayout"&gt;
      &lt;header value="[Header]&amp;#13;&amp;#10;" /&gt;
      &lt;!-- Previously... &lt;conversionPattern value="%newline%date,%utcdate,%timestamp,[%thread],%-5level,%logger,[%property{NDC}] - %message%newline%newline%newline" /&gt; --&gt;
      &lt;conversionPattern value="%newlineLOC=%date{yyyyMMdd-HH:mm:ss.fff},UTC=%utcdate{yyyyMMdd-HH:mm:ss.fff},DELTA=%timestamp,THR=%thread,%-5level,LOG=%logger,[%property{NDC}] - %message%newline%newline%newline" /&gt;
        &lt;/layout&gt;
      &lt;/appender&gt;
  
    &lt;/log4net&gt;
  </code></pre>
  
  <p>The web.config is being picked up in the Global.asax file, in the Application_Start() handler...</p>
  
  <pre class="lang-cs prettyprint-override"><code>void Application_Start(object sender, EventArgs e) 
  {
      // Start Log4Net, signal app has started
      log4net.Config.XmlConfigurator.Configure();
      log4net.ILog logger = log4net.LogManager.GetLogger("root");
      logger.Info("Application_Start()");
  }
  </code></pre>
  
  <p>The admin web page that triggers the email attempt seems to either hang indefinitely, or hang momentarily (half second) and continue.<br>
  The dev environment does not collapse with an exception, it's either hang or glide on without error.</p>
  
  <ul>
  <li>How do I get additional diagnostics out of the SmtpAppender?</li>
  <li>Can I independently test the port/config to check for a local block on outgoing programmatic email?</li>
  <li>Is a log4net email guaranteed to be sent?  The lossy and bufferSize properties
  seem very sensitive, if I put lossy=false, I get an indefinite hang...</li>
  </ul>
  
  <p>For reference I am using VS 2010, ASP.Net4, and lots of caffeine.  Thanks again for any forthcoming help.</p>