我为客户开发了一个比赛页面,他们希望客户收到的电子邮件不仅仅是文本。我使用的教程只在“发送正文消息”内提供了简单的文本。我需要添加html来感谢客户输入,并将图像引入此电子邮件。如何将HTML格式添加到'基于PHP邮件的Swift邮件教程'?
的代码是:
//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('[email protected]' => '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片是否工作正常,客户recieving他们的电子邮件好吧,我只是需要改变
('感谢参加比赛, 我们会联系你的,如果你是一个幸运的 赢家。“)
有HTML,而不是...
如果可以的话,请给我提供一个如何将HTML集成到这个函数中的例子。
Krike嗨, 感谢回去我,我有尝试了这种在表格代码中输入函数的方法,基本上我收到的电子邮件然后向我显示标签,而不是使用标签来设置文本的样式。你知道其他方式吗? – Daniel 2010-04-29 15:52:26
没关系,我搞定了。非常感谢你的帮助克里克。 :-) – Daniel 2010-04-29 16:36:54
很高兴你可以使它的工作,我认为内容类型已全部设置为HTML,但我想它没有看到galens回复。 – Christophe 2010-04-29 16:42:51