title: Transport.send not working on javax.mail library
body: <p>I have to classes the main class plus JavaMailUtl class
  This is my JavaMailUtl class:</p>
  
  <pre><code>import javax.mail.Authenticator;
  import java.util.Properties;
  import java.util.logging.Level;
  import java.util.logging.Logger;
  import javax.mail.Message;
  import javax.mail.Session;
  import javax.mail.Transport;
  import javax.mail.internet.InternetAddress;
  import javax.mail.internet.MimeMessage;
  
  
  public class JavaMailUtl {
      public static void sendMail(String recepient) throws Exception{
          System.out.println("Preparing Email");
          Properties properties = new Properties();
  
          properties.put("mail.smtp.auth", "true");
          properties.put("mail.smtp.starttls.enable", "true");
          properties.put("mail.smtp.host", "smtp.gmail.com");
          properties.put("mail.smtp.port", "587");
  
          String myAccountEmail = "someEmail@gmail.com";
          String password = "xxxxxxxx";
  
          Session session = Session.getInstance(properties, new Authenticator() {
              @Override
              protected javax.mail.PasswordAuthentication getPasswordAuthentication() {
                  return new javax.mail.PasswordAuthentication(myAccountEmail, password);
              }
  
  });
          Message message = prepareMessage(session, myAccountEmail, recepient);
          Transport.send(message);
          System.out.println("Message sent!");
      }
  
      private static Message prepareMessage(Session session, String myAccountEmail, String recepient){
          try {
              Message message = new MimeMessage(session);
              message.setFrom(new InternetAddress(myAccountEmail));
              message.setRecipient(Message.RecipientType.TO, new InternetAddress(recepient));
              message.setSubject("Gmail API");
              message.setText("This Message sent from Java APP");
          } catch (Exception ex) {
              Logger.getLogger(JavaMailUtl.class.getName()).log(Level.SEVERE, null, ex);
          }
          return null;
      }
  }
  
  </code></pre>
  
  <p>and this is my main class:</p>
  
  <pre><code>public class JavaEmailMessaging {
  
      /**
       * @param args the command line arguments
       */
      public static void main(String[] args) throws Exception {
          JavaMailUtl.sendMail("someOtherEmail@gmail.com");
      }
  
  }
  </code></pre>
  
  <p>When I try to run the project I get the following error:</p>
  
  <pre><code>Preparing Email
  Exception in thread "main" java.lang.NullPointerException
      at javax.mail.Transport.send(Transport.java:123)
      at mailing.email.messaging.JavaMailUtl.sendMail(JavaMailUtl.java:43)
      at mailing.email.messaging.JavaEmailMessaging.main(JavaEmailMessaging.java:18)
  </code></pre>
  
  <p>Doubled check the code lots of times and found no problem for me every object I have is pointing to  the right place.</p>