title: Springboot mail
body: <p>This is the first time I'm trying to send mail, using spring-boot-starter-mail.I dont get any error but while sending my mail but i could not see any mail to my TO id.</p>
  
  <p>application.properties</p>
  
  <pre><code>spring.mail.host = smtp.mandrillapp.com
  spring.mai.username = lending@vit.in    
  spring.mail.password = ********
  spring.mail.properties.mail.smtp.auth = true
  spring.mail.properties.mail.smtp.starttls.enable = true
  spring.mail.properties.mail.smtp.socketFactory.fallback = false
  </code></pre>
  
  <p>My Application Class</p>
  
  <pre><code>@SpringBootApplication
   @ComponentScan(basePackages = {"com.mail"})
   public class MailServiceApplication extends SpringBootServletInitializer {
  
   @Override
      protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
  
          return application.sources(MailServiceApplication.class);
      }
  
  public static void main(String[] args) {
      SpringApplication.run(MailServiceApplication.class, args);
  }
  
  @Bean
  public ServletRegistrationBean jerseyServlet(){
      ServletRegistrationBean register = new ServletRegistrationBean(new ServletContainer(),"/*");
      register.addInitParameter(ServletProperties.JAXRS_APPLICATION_CLASS, JerseyInitialization.class.getName());
      return register;
  }
  }
  </code></pre>
  
  <p>JerseyInitialization.class</p>
  
  <pre><code>@Component
  public class JerseyInitialization extends ResourceConfig{
  
  public JerseyInitialization(){
      super();
      this.packages("com.mail.interfaces");
      System.out.println("111");
       //register(GenericFilter.class);
      // property(ServerProperties.MONITORING_STATISTICS_ENABLED, true);
  }
  }
  </code></pre>
  
  <p>Controller Class:</p>
  
  <pre><code>@RestController
  @Path("/mail")
  public class MailResource {
  
  @Autowired
  MailSendInter mailInter;
  
  @GET
  @Path("/send")
  public String sendMail(){
      System.out.println("inside the resource Class");
      boolean result = mailInter.send("aravind11081990@gmail.com", "Welcome Mail","Wlcome to the lending system");
      if(result){
          return "ok";    
      }else{
          return "failure";
      }
  
  }
  }
  </code></pre>
  
  <p>Interface Class:</p>
  
  <pre><code>@Service
  public interface MailSendInter {
  
  public boolean send(String to, String subject, String body);
  }
  </code></pre>
  
  <p>ImplementationClass:</p>
  
  <pre><code>@Component
  public class MailSendImplementation implements MailSendInter{
  
  @Autowired
  private JavaMailSender javaMailSender;
  
  @Override
  public boolean send(String to, String subject, String body) {
      // TODO Auto-generated method stub
      boolean result = false;
      MimeMessage mimeMessage = javaMailSender.createMimeMessage();
      try{
  
          MimeMessageHelper helper ;
          helper = new MimeMessageHelper(mimeMessage, true);
          helper.setTo(to);
          helper.setSubject(subject);
          helper.setText(body, true);
          javaMailSender.send(mimeMessage);
          result = true;
      }catch(MessagingException mex){
          result = false;
          System.err.println("Expection"+mex);
      }
      return result;
  }
  }
  </code></pre>
  
  <p>Pom.Xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
  &lt;groupId&gt;com.mail&lt;/groupId&gt;
  &lt;artifactId&gt;MailService&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;jar&lt;/packaging&gt;
  
  &lt;name&gt;MailService&lt;/name&gt;
  &lt;description&gt;Demo project for Spring Boot&lt;/description&gt;
  
  &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.3.2.RELEASE&lt;/version&gt;
      &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
  &lt;/parent&gt;
  
  &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;java.version&gt;1.8&lt;/java.version&gt;
  &lt;/properties&gt;
  
  &lt;dependencies&gt;
      &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;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-jersey&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
  
    &lt;dependency&gt;
      &lt;groupId&gt;javax.mail&lt;/groupId&gt;
      &lt;artifactId&gt;mail&lt;/artifactId&gt;
      &lt;version&gt;1.4.3&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>I'm using Mandrill for sending mail</p>
  
  <p>URL:<a href="https://www.mandrill.com" rel="nofollow">https://www.mandrill.com</a>
  Username : lending@vit.in
  Password: ********</p>
  
  <p>Host : smtp.mandrillapp.com
  Port : 587
  SMTP Username :  lending@vit.in
  SMTP Password : ********</p>
  
  <p>Can some one help to figure out the error </p>