title: com.sun.mail.smtp.SMTPAddressFailedException
body: <p>I'm trying to generate and send an automatic mail with Spring.</p>
  
  <p>I have this exception when try to send email:</p>
  
  <pre><code>org.springframework.mail.MailSendException: Failed messages: javax.mail.SendFailedException: Invalid Addresses;
  nested exception is:
  com.sun.mail.smtp.SMTPAddressFailedException: 550 5.1.8 &lt;Gaetano@ConseltiGT&gt;: Sender address rejected: Domain not found
  ; message exception details (1) are:
  Failed message 1:
  javax.mail.SendFailedException: Invalid Addresses;
  </code></pre>
  
  <p>Within the application-context.xml file, I have:</p>
  
  <pre><code>    &lt;bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl"
      p:host="${email.account.host}" p:port="${email.account.port}"
      p:username="${email.account.username}" p:password="${email.account.password}"
      p:javaMailProperties-ref="javaMailProperties"/&gt;
  
  &lt;util:properties id="javaMailProperties"&gt;
      &lt;prop key="mail.smtp.auth"&gt;${email.account.smtp.auth}&lt;/prop&gt;
      &lt;prop key="mail.smtp.starttls.enable"&gt;${email.account.smtp.starttls.enable}&lt;/prop&gt;
  &lt;/util:properties&gt;
  </code></pre>
  
  <p>Within the service I have:</p>
  
  <pre><code>  @Service
    @Slf4j
    public class EmailSenderTUService {
  
  @Autowired
  private JavaMailSender mailSender;
  
  private String messageDefault = "Il sistema TESORERIA UNICA TELEMATICA richiede attenzione\n";
  
  
  public void sendMail(String subj, String msg) {
      MimeMessage message = mailSender.createMimeMessage();
      MimeMessageHelper helper = new MimeMessageHelper(message);
      try {
          helper.setTo("g.tortora@conselti.it");
          helper.setSubject(subj);
          helper.setText(messageDefault + msg);
      } catch (MessagingException e) {
          log.error("ERRORE Invio email", e);
      }
      mailSender.send(message);
  }
  
  }
  </code></pre>
  
  <p>Suggestions? </p>