我正在尝试使用 amazon ses PHP sdk 发送电子邮件。
我得到了以下代码。工作正常
$body = "
<html>
<head>
<title>HTML email</title>
</head>
<body>
<p>This email contains HTML Tags!</p>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
</tr>
</table>
</body>
</html>
";
require_once('ses.php');
$ses = new SimpleEmailService('KEY', 'KEY');
$m = new SimpleEmailServiceMessage();
$m->addTo('mail@gmail.com');
$m->setFrom('Test Support <test@test.com>');
$m->setSubject('Hello, world!');
$m->setMessageFromString($body);
print_r($ses->sendEmail($m));
此代码运行良好,但我对如何通过此脚本发送 HTML 格式的邮件感到困惑。
这样的 body
$body='<div ><b>Name</b></div>';
谁能帮帮我 提前致谢
最佳答案
好的,我想我已经找到您正在使用的系统,它看起来不像标准的 SES api。
尝试
$m->setMessageFromString($plainTextBody,$HTMLBody);
在该行之前的 $plainTextBody
和 $HTMLBody
中定义了电子邮件的纯文本版本和 html 版本。
关于php - Amazon SES - 通过 PHP sdk 发送 HTML 邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17347833/