我正在尝试使用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='<div ><b>Name</b></div>';
有人请帮帮我提前感谢
好吧,我已经找到了你正在使用的系统,它看起来不像标准的SES api。
尝试
$m->setMessageFromString($plainTextBody,$HTMLBody);
在该行之前的$plainTextBody
和$HTMLBody
中定义了电子邮件的纯文本版本和html版本。
如果您按照这里的示例然后使用css 发送html电子邮件
$request['Message']['Body']['Html']['Data'] = $to;
也就是用Html