我们制作了一个表单,我们正在使用swiftmailor库将其数据发送到电子邮件中。
如果用户从桌面浏览器填写数据,那么数据将以没有HTML标签的正确格式显示,但如果用户从移动浏览器填写数据,那么HTML标签将出现在电子邮件中。
请问是手机浏览器的问题还是swiftmailor的问题?
我们正在使用header:
$headers = "From: " . 'XYZ' . "'r'n";
$headers .= "MIME-Version: 1.0'r'n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1'r'n";
和通过swiftmailor发送邮件
$message = Swift_Message::newInstance('Enquiry FORM')
->setFrom(array('noreply@XYZ.com' => 'XYZ'))
->setTo(array($sendTo))
->setBody($messageContent, 'text/html') ;
// Send the message
$result = $mailer->send($message);
请建议应该实现什么解决方案,以便两个浏览器都可以发送html格式
使用
setBody($this->renderView($messageContent), 'text/html');
而不是
setBody($messageContent, 'text/html') ;