确保你已经正确配置了 AWS SES 并且有足够的配额。可以通过检查相应的限制信息或使用 AWS 的配额管理工具进行检查。
检查你的 AWS SES 发送电子邮件的代码是否正确,包括验证和授权过程。以下代码示例展示了使用 PHP 发送邮件的基本方式:
use Aws\Ses\SesClient;
$client = new SesClient([
'version' => 'latest',
'region' => 'us-west-2',
'credentials' => [
'key' => 'YOUR_AWS_ACCESS_KEY_ID',
'secret' => 'YOUR_AWS_SECRET_ACCESS_KEY',
],
]);
$result = $client->sendEmail([
'Destination' => [
'ToAddresses' => [
'RECIPIENT@EXAMPLE.COM',
],
],
'Message' => [
'Body' => [
'Html' => [
'Charset' => 'UTF-8',
'Data' => 'Hello, world!
',
],
'Text' => [
'Charset' => 'UTF-8',
'Data' => 'Hello, world!',
],
],
'Subject' => [
'Charset' => 'UTF-8',
'Data' => 'Test email',
],
],
'Source' => 'SENDER@EXAMPLE.COM',
]);
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
$mail = new PHPMailer(true);
try {
$mail->SMTPDebug = 2;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'your@gmail.com';
$mail->Password = 'yourpassword';
$mail->SMTPSecure = 'tls';
$mail