首页 > 解决方案 > 发送电子邮件 MessageRejected 时出现 Amazon SES 错误

问题描述

我正在使用 php 通过 Amazon SES 发送电子邮件并使用这个 github 库

https://github.com/okamos/php-ses#getting-started

但是当我发送我收到此错误时,我的电子邮件和域都已验证

     "MessageRejected" ["description"]=> string(134) "Indicates that the action failed, and the message could not be sent. Check the error stack for a description of what caused the error." } 

当我在 aws 中检查这个错误时,我发现了这个

 https://docs.aws.amazon.com/ses/latest/DeveloperGuide/troubleshoot-error-messages.html

这里它说
如果您直接调用 Amazon SES API,查询操作将返回错误。该错误可能是 MessageRejected 或 Amazon Simple Email Service API Reference 的常见错误主题中指定的错误之一。

我们在哪里失踪??

require 'autoload.php';

require 'src/ses.php';


$ses = new SimpleEmailService(
    'xxxxxxxxx',
    'xxxxxxxxxxxx', 
    'us-east-1' 
);


$envelope = new SimpleEmailServiceEnvelope(
    'noreply@xxxxxxxx.com',
    'This is test email',
    'Hello how are you. this is test email'
);


$envelope->addTo('ffffff@hhhhh.com');

$requestId = $ses->sendEmail($envelope);

var_dump($requestId);

为什么我们会收到此错误

标签: phpamazon-web-servicesamazon-ses

解决方案


当您通过 SES 发送邮件时,特别是如果您发送大量邮件时,最佳做法是使用队列。例如,您可以使用 AWS SQS 通过 SES 发送邮件并避免该问题。


推荐阅读