ram*_*esh 3 php email amazon-web-services amazon-ses
我正在尝试使用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));
Run Code Online (Sandbox Code Playgroud)
这段代码非常好用,我很困惑如何通过这个脚本发送HTML格式的邮件.
像这样的身体
$body='<div ><b>Name</b></div>';
Run Code Online (Sandbox Code Playgroud)
任何人请帮助我提前谢谢
好吧,我想我找到了你正在使用的系统,它看起来不像标准的SES api.
尝试
$m->setMessageFromString($plainTextBody,$HTMLBody);
Run Code Online (Sandbox Code Playgroud)
您在该行之前$plainTextBody和$HTMLBody之前定义了电子邮件的纯文本版本和html版本的位置.