title: Can I set custom from for mails JavaMailSenderImpl
body: <p>I use JavaMailSenderImpl in my web-app (Spring MVC). I send mails from some acc, for example "sender@gmail.com". I need setFrom to another acc , for example "sender2@gmail.com". How I can do it? I try <code>setFrom("sender2@gmail.com")</code>, but users receives mails with From: "sender@gmail.com". What am I doing wrong?
  My config:</p>
  
  <pre><code>public JavaMailSenderImpl mailSender() {
      JavaMailSenderImpl javaMailSenderImpl = new JavaMailSenderImpl();
      try {
          javaMailSenderImpl.setHost("smtp.gmail.com");
          javaMailSenderImpl.setPort(567);
          javaMailSenderImpl.setUsername("sender@gmail.ua");
          javaMailSenderImpl.setPassword("*********");
          javaMailSenderImpl.getJavaMailProperties().put("mail.smtp.host", "smtp.gmail.com");
          javaMailSenderImpl.getJavaMailProperties().put("mail.smtp.port", "465");
          javaMailSenderImpl.getJavaMailProperties().put("mail.debug", "true");
          javaMailSenderImpl.getJavaMailProperties().put("mail.smtp.auth", "true");
          javaMailSenderImpl.getJavaMailProperties().put("mail.smtp.starttls.enable", "true");
          javaMailSenderImpl.getJavaMailProperties().setProperty("mail.smtp.socketFactory.port", "465");
          javaMailSenderImpl.getJavaMailProperties().setProperty("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
          javaMailSenderImpl.getJavaMailProperties().setProperty("mail.smtp.socketFactory.fallback", "false");
      } catch (Exception e) {
          logger.error(e.getMessage());
      }
      return javaMailSenderImpl;
  }
  </code></pre>
  
  <p>And my code for send emails:</p>
  
  <pre><code>MimeMessage message2 = javaMailSenderImpl.createMimeMessage();
          Address  from = new InternetAddress("sender2@gmail.com");
          message2.setFrom(from);
          MimeMessageHelper helper = new MimeMessageHelper(message2, true);
          helper.setFrom("sender2@gmail.com");
  /*adding body,subject etc*/
   javaMailSenderImpl.send(message2);
  </code></pre>