【发布时间】:2010-04-29 15:22:59
【问题描述】:
我为客户开发了一个竞赛页面,他们希望客户收到的电子邮件不仅仅是文本。我使用的教程仅在“发送正文消息”中提供了简单的文本。我需要添加 html 以感谢客户进入,并在此电子邮件中介绍图像。
代码是:
//send the welcome letter
function send_email($info){
//format each email
$body = format_email($info,'html');
$body_plain_txt = format_email($info,'txt');
//setup the mailer
$transport = Swift_MailTransport::newInstance();
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance();
$message ->setSubject('Thanks for entering the competition');
$message ->setFrom(array('info@examplemail.com' => 'FromEmailExample'));
$message ->setTo(array($info['email'] => $info['name']));
$message ->setBody('Thanks for entering the competition, we will be in touch if you are a lucky winner.');
$result = $mailer->send($message);
return $result;
}
这个function.php工作表正在工作,客户正在收到他们的电子邮件,我只需要更改
('感谢您参加比赛, 如果您很幸运,我们会与您联系 赢家。')
改为使用 HTML...
如果可以,请提供一个示例,说明如何将 HTML 集成到此功能中。
【问题讨论】: