title: email is not sent using simpleMailMessage
body: <p>I am trying to send an email using spring boot to do so I created an account on  <a href="https://mailtrap.io/" rel="nofollow noreferrer">mailtrap.io</a> and I added the necessary configuration like below</p>
  
  <pre><code> spring.mail.host=smtp.mailtrap.io
  spring.mail.port=2525
  spring.mail.username=0cfcf8adb32fea
  spring.mail.password=20d3c0f7a44694
  spring.mail.properties.mail.smtp.auth=true
  spring.mail.properties.mail.smtp.starttls.enable=true
  </code></pre>
  
  <p>then i created a configuration java file like this :</p>
  
  <pre><code>package com.example.databasedemo;
  import org.springframework.beans.factory.annotation.Value;
  import org.springframework.stereotype.Component;
  
  @Component
  public class Emailcfg {
      @Value("${spring.mail.host}")
      private String host;
  
      @Value("${spring.mail.port}")
      private int port;
  
      @Value("${spring.mail.username}")
      private String username;
  
      @Value("${spring.mail.password}")
      private String password;
  
      public String getHost() {
          return host;
      }
  
      public void setHost(String host) {
          this.host = host;
      }
  
      public int getPort() {
          return port;
      }
  
      public void setPort(int port) {
          this.port = port;
      }
  
      public String getUsername() {
          return username;
      }
  
      public void setUsername(String username) {
          this.username = username;
      }
  
      public String getPassword() {
          return password;
      }
  
      public void setPassword(String password) {
          this.password = password;
      }
  }
  </code></pre>
  
  <p>and a Rest controller:</p>
  
  <pre><code>    package com.example.databasedemo;
  
  import org.springframework.mail.SimpleMailMessage;
  import org.springframework.mail.javamail.JavaMailSenderImpl;
  import org.springframework.validation.BindingResult;
  import org.springframework.web.bind.annotation.*;
  
  
  import javax.validation.ValidationException;
  
  @RestController
  @RequestMapping("/Mail")
  public class mailController {
  
      private Emailcfg emailCfg;
      public  mailController(Emailcfg emailCfg){
          this.emailCfg = emailCfg;
      }
  
  
      @GetMapping
      public void senddmail(){
  
          // Create a mail sender
          JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
          mailSender.setHost(this.emailCfg.getHost());
          mailSender.setPort(this.emailCfg.getPort());
          mailSender.setUsername(this.emailCfg.getUsername());
          mailSender.setPassword(this.emailCfg.getPassword());
          // Create an email instance
          SimpleMailMessage mailMessage = new SimpleMailMessage();
         mailMessage.setFrom("elahidri.eh@gmail.com");
          mailMessage.setTo("elahidri.eh@gmail.com");
          mailMessage.setSubject("mail");
          mailMessage.setText("this is a mail test ");
  
          // Send mail
          mailSender.send(mailMessage);
  
      }
  
  }
  </code></pre>
  
  <p>when I tried to execute it I got no error but I did not receive the email even throw I found the email in the mailtrap.io box 
   <strong>UPDATE</strong> 
  this is the message I got when I debug it :</p>
  
  <pre><code>DEBUG: JavaMail version 1.6.1
  DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
  DEBUG: Tables of loaded providers
  DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle]}
  DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]}
  DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
  DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]
  DEBUG SMTP: useEhlo true, useAuth true
  DEBUG SMTP: trying to connect to host "smtp.mailtrap.io", port 2525, isSSL false
  220 mailtrap.io ESMTP ready
  DEBUG SMTP: connected to host "smtp.mailtrap.io", port: 2525
  EHLO elahidri
  250-mailtrap.io
  250-SIZE 5242880
  250-PIPELINING
  250-ENHANCEDSTATUSCODES
  250-8BITMIME
  250-DSN
  250-AUTH PLAIN LOGIN CRAM-MD5
  250 STARTTLS
  DEBUG SMTP: Found extension "SIZE", arg "5242880"
  DEBUG SMTP: Found extension "PIPELINING", arg ""
  DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
  DEBUG SMTP: Found extension "8BITMIME", arg ""
  DEBUG SMTP: Found extension "DSN", arg ""
  DEBUG SMTP: Found extension "AUTH", arg "PLAIN LOGIN CRAM-MD5"
  DEBUG SMTP: Found extension "STARTTLS", arg ""
  STARTTLS
  220 2.0.0 Start TLS
  EHLO elahidri
  250-mailtrap.io
  250-SIZE 5242880
  250-PIPELINING
  250-ENHANCEDSTATUSCODES
  250-8BITMIME
  250-DSN
  250 AUTH PLAIN LOGIN CRAM-MD5
  DEBUG SMTP: Found extension "SIZE", arg "5242880"
  DEBUG SMTP: Found extension "PIPELINING", arg ""
  DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
  DEBUG SMTP: Found extension "8BITMIME", arg ""
  DEBUG SMTP: Found extension "DSN", arg ""
  DEBUG SMTP: Found extension "AUTH", arg "PLAIN LOGIN CRAM-MD5"
  DEBUG SMTP: protocolConnect login, host=smtp.mailtrap.io, user=0cfcf8adb32fea, password=&lt;non-null&gt;
  DEBUG SMTP: Attempt to authenticate using mechanisms: LOGIN PLAIN DIGEST-MD5 NTLM XOAUTH2 
  DEBUG SMTP: Using mechanism LOGIN
  DEBUG SMTP: AUTH LOGIN command trace suppressed
  DEBUG SMTP: AUTH LOGIN succeeded
  QUIT
  221 2.0.0 Bye
  </code></pre>