我正在尝试使用SES SDK 2.7中的sendRawEmail
方法发送以下由PHPMailer 5.2.9生成的原始电子邮件消息:
Date: Tue, 28 Oct 2014 03:34:18 +0000
From: someemail@gmail.com
Reply-To: someemail@gmail.com
Message-ID: <c738074625a476ed8e2793323ad0b3b2@*.dev>
X-Priority: 3
X-Mailer: PHPMailer
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="b1_c738074625a476ed8e2793323ad0b3b2"
Content-Transfer-Encoding: 8bit
To: someperson@gmail.com
Subject: Test subject (TID #1, SID #2)
--b1_c738074625a476ed8e2793323ad0b3b2
Content-Type: text/plain; charset=us-ascii
Test email for _Some One_!
--b1_c738074625a476ed8e2793323ad0b3b2
Content-Type: text/html; charset=us-ascii
Test email for <i>Some One</i>!
--b1_c738074625a476ed8e2793323ad0b3b2--
以下是用于生成原始电子邮件并发送的代码:
以下是用于生成原始电子邮件并发送的代码:
$mail = new PHPMailer();
$mail->addAddress($to);
$mail->setFrom($from);
$mail->Subject = $subject;
$mail->CharSet = $char_set;
$mail->AltBody = $text;
$mail->Body = $html;
$mail->isHTML(true);
$mail->addAttachment($attachment);
$mail->preSend();
$args = [
'Source' => $from,
'Destinations' => [$to],
'RawMessage' => [
'Data' => $mail->getSentMIMEMessage()
]
];
$aws = Aws\Common\Aws::factory(app_path() . '/config/aws.php');
$ses = $aws->get('ses');
$send_result = $ses->sendRawEmail($args);
我在$send_result
中没有收到任何错误,只有一个标准的'MessageId'和'RequestId',就像成功发送一样(实际上确实已经发送了)。
我也尝试过带附件和不带附件,但它仍然将消息发送为混乱的信息。这是接收到的内容:http://prntscr.com/50ij42
我在这里做错了什么?