title: Why i need to define bean javaMailSenderImpl in config file,when i am using external property file in spring boot?
body: <p>I am trying to use external property file in spring Boot application.But when i am running the application it is suggesting me to define bean of javaMailSender.</p>
  
  <p>When i am defining a bean of javaMailSenderImpl it is running fine.
  But while sending any email it is showing exception</p>
  
  <p>Failed messages: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: localhost, 25; timeout -1;</p>
  
  <p>Here is my code-</p>
  
  <pre><code>@Bean
  public org.springframework.mail.javamail.JavaMailSenderImpl javaMailSenderImpl(){
      return new org.springframework.mail.javamail.JavaMailSenderImpl();
  }
  @Bean
  public PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
      PropertySourcesPlaceholderConfigurer properties = new PropertySourcesPlaceholderConfigurer();
      properties.setLocation(new FileSystemResource("C:\\Users\\Rishabh Sharma\\Desktop\\app.properties"));
      properties.setIgnoreResourceNotFound(false);
      return properties;
  }
  </code></pre>