php - 发送电子邮件 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);
为什么我们会收到此错误
解决方案
当您通过 SES 发送邮件时,特别是如果您发送大量邮件时,最佳做法是使用队列。例如,您可以使用 AWS SQS 通过 SES 发送邮件并避免该问题。
推荐阅读
- java - Selenium Chrome DevTools:未知错误:无法在 localhost:6666 从 chrome 连接到 chrome 无法访问
- mongoose - 如何在nestjs中填充猫鼬引用?
- python - 困难的 groupby() 和数据分析问题(Python)(如何简化)
- c++ - 为什么用 C++ std::array 创建二维数组需要额外的一对 {}
- kotlin - 嵌套片段不会回到前一个片段
- computer-vision - 高 mAP@50,精度和召回率低。这是什么意思,什么指标应该更重要?
- java - 尝试在 android 5.0 设备上的 onCreate 方法中启动新活动时应用程序崩溃
- javascript - 如何将多个参数放入 onClick 属性
- python - 用于加密的初学者凯撒密码解密过程
- android - Android-Amplify:使用 Amplify 向/从 AWS S3 上传/下载文件