title: Sending Email via Spring boot "spring-boot-starter-mail"
body: <p>I am trying to send emails using spring boot, but am getting:</p>
  
  <pre><code>java.lang.UnsupportedOperationException: Method not yet implemented
          at javax.mail.internet.MimeMessage.&lt;init&gt;(MimeMessage.java:89)
          at org.springframework.mail.javamail.SmartMimeMessage.&lt;init&gt;(SmartMimeMessage.java:52)
          at org.springframework.mail.javamail.JavaMailSenderImpl.createMimeMessage(JavaMailSenderImpl.java:325)
  </code></pre>
  
  <p>I have used this maven entry:</p>
  
  <pre><code>    &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;1.2.6.RELEASE&lt;/version&gt;
      &lt;/parent&gt;
  
  &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
              &lt;version&gt;1.2.6.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-mail&lt;/artifactId&gt;
          &lt;version&gt;1.2.6.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>application.properties:</p>
  
  <pre><code>spring.mail.host=smtp.gmail.com
  spring.mail.port= 25
  spring.mail.username= test
  spring.mail.password= test
  </code></pre>
  
  <p>And My code:</p>
  
  <pre><code>@Autowired
      private JavaMailSender javaMailSender;
  
  private void send() {
          MimeMessage mail = javaMailSender.createMimeMessage();
          try {
              MimeMessageHelper helper = new MimeMessageHelper(mail, true);
              helper.setTo("mymail@mail.co.uk");
              helper.setReplyTo("someone@localhost");
              helper.setFrom("someone@localhost");
              helper.setSubject("Lorem ipsum");
              helper.setText("Lorem ipsum dolor sit amet [...]");
          } catch (MessagingException e) {
              e.printStackTrace();
          } finally {}
          javaMailSender.send(mail);
          //return helper;
      }
  </code></pre>
  
  <p>This appears to be a straight forward but don't what am I missing!</p>