title: Log4j failing to send an email when logging an error
body: <p>I enabled logging in my application, and I want to send logs error by email (gmail account). I: </p>
  
  <ol>
  <li>Set up a java project</li>
  <li>add activation.jar , log4j.java and mail.jar (java mail) </li>
  <li>I added those libraries to the project class path</li>
  <li>I added log4j.properties and I configured it like this :</li>
  </ol>
  
  <pre>
  log4j.rootLogger= mainlogger, Email, dest
  log4j.appender.mainlogger=org.apache.log4j.ConsoleAppender
  log4j.appender.mainlogger.target=System.out
  log4j.appender.mainlogger.layout=org.apache.log4j.PatternLayout
  log4j.appender.mainlogger.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %p %-4r [%t] %-5p %c %x - %m%n
  log4j.appender.dest=org.apache.log4j.FileAppender
  log4j.appender.dest.File=log.log
  log4j.appender.dest.layout=org.apache.log4j.PatternLayout
  log4j.appender.dest.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %p %-4r [%t] %-5p %c %x - %m%n
  </pre>
  
  <p><strong>Configuring the SMTP appender</strong></p>
  
  <pre><code>log4j.appender.Email=org.apache.log4j.net.SMTPAppender
  log4j.appender.Email.BufferSize=512
  log4j.appender.Email.Threshold=ERROR
  log4j.appender.Email.SMTPHost=smtp.gmail.com
  log4j.appender.Email.SMTPUsername=myusername
  log4j.appender.Email.SMTPPassword=mypassword
  log4j.appender.Email.From=myemail@gmail.com 
  log4j.appender.Email.To=myotheremail@gmail.com
  log4j.appender.Email.Subject=Error Report
  log4j.appender.Email.layout=org.apache.log4j.PatternLayout
  log4j.appender.Email.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n
  </code></pre>
  
  <p>There is nothing that happened no email sent and no error shown , and I do not understand why, Please any idea about that topic ???</p>