【问题标题】:Mailbox Simulator for the Amazon Simple Email ServiceAmazon Simple Email Service 的邮箱模拟器
【发布时间】:2019-04-24 07:30:01
【问题描述】:

如 AWS Blog 中所述,

今天,我们推出了 Amazon SES 邮箱模拟器,让您可以在不影响发送配额或推动它的退回和投诉指标的情况下测试您的应用程序。 您现在可以将测试电子邮件发送到邮箱模拟器托管的特定电子邮件地址。每个地址都有一个特定的、已定义的响应。即使您仍在 Amazon SES 沙箱中运行,您也可以向这些新地址发送电子邮件。

我正在使用 PHPMailer 来测试下面的邮箱模拟器代码

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

//Load Composer's autoloader
require 'vendor/autoload.php';
$emp_email="bounce@simulator.amazonses.com";
$emp_name="testbounce";
$mail = new PHPMailer(true);                              // Passing `true` enables exceptions
try {
    //Server settings
    $mail->SMTPDebug = 0;                                 // Disable verbose debug output
    $mail->isSMTP();                                      // Set mailer to use SMTP
    $mail->Host = 'email-smtp.us-west-2.amazonaws.com';  // Specify main and backup SMTP servers
    $mail->SMTPAuth = true;                               // Enable SMTP authentication
    $mail->Username = 'sesusername';                 // SMTP username
    $mail->Password =  'sespassword';                           // SMTP password
    $mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
    $mail->Port = 587;                                    // TCP port to connect to 

    $mail->From = 'testmail@example.com';
    $mail->FromName = "testname";
    $mail->addAddress($emp_email,$emp_name);

    //Content
    $mail->isHTML(true);                                  // Set email format to HTML
    $mail->Subject = 'Here is the subject';
    $mail->Body    = 'This is the HTML message body <b>in bold!</b>';
    $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

    $mail->send();
    echo 'Message has been sent';
} catch (Exception $e) {
    echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
}

我收到错误

无法发送消息。邮件程序错误:SMTP 错误:数据未接受。SMTP 服务器错误:DATA END 命令失败详细信息:邮件被拒绝:电子邮件地址未验证。以下身份未通过 US-WEST-2 区域的检查: testname , testmail@example.com SMTP 代码:554

据我所知,要使用 SES 发送电子邮件,我们需要以一般方式验证 From 邮件 ID。

那么如何配置模拟器来测试新的电子邮件ID。

【问题讨论】:

    标签: php amazon-web-services email amazon-ses


    【解决方案1】:

    您发送的所有地址都必须经过验证。您可以通过控制台或 API 执行此操作。 See the documentation。你也可以verify an entire domain

    【讨论】:

    • 感谢您抽出宝贵时间,但我想知道如何在发送前验证批量电子邮件地址。如果它们不正确,它会影响声誉统计信息(反弹等)。 AWS 是否提供验证批量电子邮件 ID 的服务
    • AWS 不提供电子邮件验证。试试 Kickbox.com
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-13
    相关资源
    最近更新 更多