使用 AWS SES SMTP - 错误 554 消息被拒绝:电子邮件地址未验证。以下身份未通过区域签入

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

我尝试向其发送电子邮件的电子邮件地址出现此错误!

不确定为什么我需要验证我发送的电子邮件不属于我?

调试 SMTP:发送时发生 MessagingException,抛出: com.sun.mail.smtp.SMTPSendFailedException: 554 消息被拒绝:电子邮件地址未验证。以下身份未通过区域 EU-WEST-1 的检查:danielhaughton@outlook.com

@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;
}

电子邮件服务 @零件 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("noreply@mydomain.com");
    message.setSubject(subject);
    message.setText(text);
    emailSender.send(message);
}
}

我的 emailserviceimpl 自动连接到我发送电子邮件的 Web 控制器中

默认情况下,您的 AWS 账户的 SES 功能是沙盒化的,并且在 SES 沙盒中具有某些限制。

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.

查看此博客 post,其中概述了退出沙盒的步骤。 https://aws.amazon.com/blogs/ses/ses-limit-increase-form-consolidation/

按照步骤验证您的电子邮件。