title: Mail is not working with javax.mail-api-1.5.1
body: <p>I have implemented one same program to test my mail server.</p>
  
  <pre><code>public void sendMail() {
          System.out.println("Send Mail Called");
          try{
              System.out.println("Constructor called ");
              Properties props = new Properties();
              props.put("mail.smtp.host","host");
              props.put("mail.smtp.port", "port");    
              props.put("mail.debug", "true");
              props.put("mail.smtp.auth", "true");
              Session session = Session.getInstance(props, null);
  
              MimeMessage mail = new MimeMessage(session);
  
              //Set Mailer string in Header.. 
              mail.setHeader("X-Mailer", "ABC");
              InternetAddress[] recList = new InternetAddress[1];
              recList[0] = new InternetAddress("receient@abc.com");
              mail.setRecipients(Message.RecipientType.TO, recList);
  
              mail.setFrom(new InternetAddress("receiver@abc.com"));
              mail.setSubject("This is demo test mail");
  
              Multipart mp = new MimeMultipart();
  
              MimeBodyPart mbp1 = new MimeBodyPart();
  
              //messageMIME can be "text/plain" or "text/html" or anything related to mime
              mbp1.setContent("Hi this is test demo","text/html");
              mp.addBodyPart(mbp1);
  
              mail.setContent(mp);
              mail.saveChanges();
  
              mail.setSentDate(new Date());
  
              // Send the message
              Transport trans = session.getTransport("smtp");
              trans.connect("host","username","password");
              trans.sendMessage(mail, mail.getAllRecipients());
              trans.close();
              System.out.println("Mail successfully send");
          }catch (Exception e) {
              e.printStackTrace();
          }
      }
  </code></pre>
  
  <p>But when I am running above method, I am receiving below exception.</p>
  
  <pre><code>java.lang.ClassNotFoundException: com.sun.mail.util.MailLogger
          at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
          at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
          at javax.mail.Session.initLogger(Session.java:221)
          at javax.mail.Session.&lt;init&gt;(Session.java:206)
          at javax.mail.Session.getInstance(Session.java:242)
          at Register.sendMail(Register.java:125)
          at Register.doPost(Register.java:22)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
          at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
          at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
          at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
          at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)
          at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
          at java.lang.Thread.run(Thread.java:662)
  </code></pre>
  
  <p>After analysing on same error, I came to know that it required adding of below Maven POM</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;com.sun.mail&lt;/groupId&gt;
      &lt;artifactId&gt;javax.mail&lt;/artifactId&gt;
      &lt;version&gt;1.5.2&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>But I can't get where to add it, because I am not using Maven, I am simply running sample java program.</p>