title: Not getting any response while using JavaMail API
body: <p>I am trying to send an email from a webpage to my email id using Gmail smtp server. I tried various answers on stackoverflow. Unfortunately, none of them worked.</p>
  
  <pre><code>   `public void sendMail(String msg){
  
      Properties props= System.getProperties();
      props.put("mail.smtp.host", "smtp.gmail.com");
      props.put("mail.smtp.auth", "true");
      props.put("mail.smtp.port", "465");
      props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
      props.put("mail.smtp.socketFactory.port", "465");
      props.put("mail.smtps.debug", "true");
      props.put("mail.smtp.socketFactory.fallback", "false");
      //props.put("mail.smtp.ssl.enable", "true");
      //props.put("mail.transport.protocol", "smtp");
  
      Authenticator authenticate= new Authenticator(){
              protected PasswordAuthentication getPasswordAuthentication(){
              return new PasswordAuthentication(username, password);
              }
              };
      @SuppressWarnings("deprecation")
      Session mailSession= Session.getInstance(props, authenticate);
      mailSession.setDebug(true);
  
      Message mailMessage= new MimeMessage(mailSession);
  
      try {
          mailMessage.setFrom(new InternetAddress(mailFrom));
          mailMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(mailTo));
          mailMessage.setSubject(subject);
          mailMessage.setText(msg);
  
          Transport trans= mailSession.getTransport("smtp");
          trans.connect("smtp.gmail.com", username, password);
          trans.sendMessage(mailMessage, mailMessage.getAllRecipients());
          trans.close();
  
      } catch (Exception ex) {
          Logger.getLogger(MailSender.class.getName()).log(Level.SEVERE, null, ex);
      }
  
  }` 
  </code></pre>
  
  <p>I am trying above written code</p>
  
  <p><code>DEBUG: setDebug: JavaMail version 1.5.4
    Info:   DEBUG: getProvider() returning 
    javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
    Info:   DEBUG SMTP: useEhlo true, useAuth true
    Info:   DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 465, isSSL false</code></p>
  
  <p>And, this is I am getting as an output with no exceptions, no messages and not even an email to my email address.
  I am using JavaMail API 1.5.4 Java 8 and GlassFish Server as a localhost server with reference to an online tutorial. </p>
  
  <p>Please help!!</p>