通过SES SMTP接口发送HTML电子邮件 - PEAR

时间:2016-09-30 07:04:53

标签: html-email pear amazon-ses

我希望发送HTML电子邮件。我尝试使用mime.php但无法使其正常工作。以下是我的工作文本电子邮件代码:

<?php
$subject="hello-test";
$body="<html><body><h1>message body</h1></body></html>";

$em_arr=array("email@example.com");
foreach ($em_arr as $to_address)
{

require_once '/usr/local/share/pear/Mail.php';

$headers = array (
  'Content-Type:text/html;charset=UTF-8',
  'From' => 'Test <test@example.com>',
  'To' => $to_address,
  'Subject' => $subject);

$smtpParams = array (
  'host' => '<smtp host address>',
  'port' => 587,
  'auth' => true,
  'username' => '<uname>',
  'password' => '<password>'
);

 // Create an SMTP client.
$mail = Mail::factory('smtp', $smtpParams);

// Send the email.
$result = $mail->send($to_address, $headers, $body);

if (PEAR::isError($result)) {
  echo("Email not sent. " .$result->getMessage() ."\n");
} else {
  echo("Email sent to ".$to_address."\n");
}
}
?>

请告诉我如何发送HTML电子邮件。

1 个答案:

答案 0 :(得分:0)

我必须将[cell setSelectionStyle:UITableViewCellSelectionStyleNone]; 标题行替换为:

Content

这就是上面的错误。现在工作正常。