我正在尝试使用我的yahoo凭证从PHP发送邮件。
$Mbody=$Mbody."<body>";
$Mbody=$Mbody."<table border=0>";
$Mbody=$Mbody."<tr>";
$Mbody=$Mbody."<td>Hi,</td>";
$Mbody=$Mbody."</tr>";
$Mbody=$Mbody."<tr>";
$Mbody=$Mbody."<td>New Mail for testing.</td>";
$Mbody=$Mbody."</tr>";
$Mbody=$Mbody."<tr>";
$Mbody=$Mbody."<td><a href=http://www.google.com >Verify Account</a></td>";
$Mbody=$Mbody."</tr>";
$Mbody=$Mbody."</table>";
$Mbody=$Mbody."</body>";
$Mbody=$Mbody."</html>";
$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl";
$mail->Host = "plus.smtp.mail.yahoo.com";
$mail->Port = 465; // set the SMTP port
$mail->Username = "********";
$mail->Password = "********";
$mail->From = "********";
$mail->FromName = "my Name";
$mail->AddAddress('********');
$mail->Subject = "Subject";
$mail->Body = $Mbody;
当我执行代码时,它会将邮件发送到所需的收件人,但正文显示收到的邮件中的所有HTML标记。上面的代码中缺少什么。
答案 0 :(得分:1)
请将内容类型用作HTML
$mail->IsHTML(true); // send as HTML
答案 1 :(得分:1)
试试这个
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Subject';
$mail->MsgHTML($Mbody);
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';