title: JAVA Spring mail sending via gmail
body: <p>I want to send emails using gmail smtp server and spring mail sender, it doesn' throw any exceptions but my mail isn't sent i don't receive it.</p>
  
  <p>Here's how Service looks:</p>
  
  <pre><code>@Service
  public class MailSenderService {
  
      @Autowired
      public MailSender mailSender;
  
      public void prepareAndSend(String recipient, String message) {
          try {
  
              SimpleMailMessage mail = new SimpleMailMessage();
              String from = "testSender1@gmail.com";
              String to = "testRecipient1@gmail.com";
              String subject = "Test subject";
              mail.setFrom(from);
              mail.setTo(recipient);
              mail.setSubject(subject);
              mail.setText(message);
              mailSender.send(mail);
          } catch (Exception ex) {
              ex.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>AppProperties </p>
  
  <pre><code>spring.mail.host = smtp.gmail.com
  spring.mail.username = ********@gmail.com
  spring.mail.password = ********
  spring.mail.properties.mail.smtp.auth = true
  spring.mail.properties.mail.smtp.socketFactory.port = 465
  spring.mail.properties.mail.smtp.socketFactory.class = javax.net.ssl.SSLSocketFactory
  spring.mail.properties.mail.smtp.socketFactory.fallback = false
  spring.mail.properties.mail.smtp.ssl.enable = true
  </code></pre>
  
  <p>And pom dependency</p>
  
  <pre><code>&lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-mail&lt;/artifactId&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>I deploy my app on port 8080 and just call this service with these two parameters, no exception is caught but in my testRecipient1 inbox i don't find any new mail, what have i missed ?</p>