我正试图用这个[巨大的连接]
制作邮件正文$body='<table border=1>'.'<tr>'.'<th>Description</th>'.'<th>Quantity</th>'.'<th>Cost</th>'.'</tr>';
for($x=0;$x<=$length-1;$x++)
{
$body .='<tr>'.'<td>'.$json2[$x]["description"].'</td>'.'<td>'.$json2[$x]["qty"].'</td>'.'<td>'.$json2[$x]["cost"].'</td>'.'</tr>';
}
$body.='</table>';
使用Swift Mailer发送它
$message = Swift_Message::newInstance('Thanks for your Order')
->setFrom(array('abc@gmail.com' => 'Sender'))
->setTo(array('xzy@gmail.com' => 'Receiver Name'))
->setBody($body,'html');
邮件收到成功,但我没看到表。
对于Feroz
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance('DialSwap - Thanks for your Order')
->setFrom(array('rorrykeys2@gmail.com' => 'DialSwap'))
->setTo(array('rorrykeys@gmail.com' => 'Receiver Name'))
->setBody($body,'text/html');
$headers = $message->getHeaders();
$headers->addTextHeader('Content-Type', 'text/html');
答案 0 :(得分:2)
答案 1 :(得分:1)
您可以添加如下所示的标题
$message = Swift_Message::newInstance();
$headers = $message->getHeaders();
$headers->addTextHeader('Content-Type', 'text/html');