Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using AWS SES SMTP- error 554 Message rejected: Email address is not verified. The following identities failed the check in region

Getting this error on the email address I am trying to send an email to!

Not sure why I need to verify an email I am sending to which doesn't belong to me?

DEBUG SMTP: MessagingException while sending, THROW: com.sun.mail.smtp.SMTPSendFailedException: 554 Message rejected: Email address is not verified. The following identities failed the check in region EU-WEST-1: [email protected]

@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("removedcreds");
    mailSender.setPassword("removed creds");
    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;
}

EmailService @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.setFrom("[email protected]");
    message.setSubject(subject);
    message.setText(text);
    emailSender.send(message);
}
}

My emailserviceimpl is autowird into a web controller that I send the email from

like image 785
Daniel Haughton Avatar asked Mar 06 '18 07:03

Daniel Haughton


2 Answers

By Default you AWS Account's SES capabilities are sandboxed, and being in SES sandbox comes with certain restrictions.

https://docs.aws.amazon.com/ses/latest/DeveloperGuide/request-production-access.html

To help protect our customers from fraud and abuse and to help you establish your trustworthiness to ISPs and email recipients, we do not immediately grant unlimited Amazon SES usage to new users. New users are initially placed in the Amazon SES sandbox. In the sandbox, you have full access to all Amazon SES email-sending methods and features so that you can test and evaluate the service; however, the following restrictions are in effect:

You can only send mail to the Amazon SES mailbox simulator and to verified email addresses and domains.

You can only send mail from verified email addresses and domains.

You can send a maximum of 200 messages per 24-hour period.

Amazon SES can accept a maximum of one message from your account per second.

See this blog post that outlines steps to get out of sandbox. https://aws.amazon.com/blogs/ses/ses-limit-increase-form-consolidation/

like image 156
Yogesh_D Avatar answered Oct 31 '22 06:10

Yogesh_D


Follow the step to verify your email.

Do the following steps to verify your email

like image 41
Kapil Shukla Avatar answered Oct 31 '22 05:10

Kapil Shukla