none
Sending email with AWS SES via SMTP,error 421 RRS feed

  • Question

  • Hi,

    So I have a space obtained through SES which I have confirmed with SES.I have tried that sending/accepting works by marking into the email with the <g class="gr_ gr_14 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="14" id="14">workmail</g> web app.I am getting the accompanying blunder when attempting to send <g class="gr_ gr_16 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="16" id="16">email</g> with my spring application. <g class="gr_ gr_15 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" data-gr-id="15" id="15">javax</g>.mail.MessagingException: Could not interface with SMTP have: email-smtp.eu-west-1.amazonaws.com, port: 25, reaction: 421

    Appconfig.Java

    @Configuration
    @PropertySource("app.properties")
    @EnableTransactionManagement
     public class AppConfig {
    @Autowired
    private Environment env;
    @Bean
    public JavaMailSender getJavaMailSender() {
        JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
        mailSender.setHost("email-smtp.eu-west-1.amazonaws.com");
        mailSender.setPort(25);
        mailSender.setUsername("noreply@mydomain.com");
        mailSender.setPassword("mypassword");
        Properties props = mailSender.getJavaMailProperties();
        props.put("mail.transport.protocol", "smtp");
        props.put("mail.smtp.auth", "true");
        props.put("mail.smtp.starttls.enable", "true");
        props.put("mail.smtp.starttls.required", "true");
    
        props.put("mail.debug", "true");
        return mailSender;
    }}
    
    
     EmailServiceImpl.java
     @Component
     public class EmailServiceImpl  {
    
    @Autowired
    public JavaMailSender emailSender;
    
    public void sendSimpleMessage(String toAddress, String subject, String text) 
    {
        SimpleMailMessage message = new SimpleMailMessage();
        message.setTo(toAddress);
        message.setSubject(subject);
        message.setText(text);
        emailSender.send(message);
    }
    }   

    EmailServiceImpl is <g class="gr_ gr_42 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" data-gr-id="42" id="42">autowired</g> into my web controller where I send an email after generating a password reset token

    Thank You

    Hari

    Monday, March 5, 2018 1:30 PM