我正在使用php邮件库发送邮件。我想在邮件正文中发送html输出。邮件已成功发送但输出未正确显示。完整的HTML代码显示。以下是我的代码。请有人帮帮我。
require_once('../../OSTboard/PHPMailer-master/class.phpmailer.php');
require_once('../../OSTboard/PHPMailer-master/PHPMailerAutoload.php');
require_once('../../OSTboard/PHPMailer-master/class.smtp.php');
$email = new PHPMailer();
$email->SMTPDebug = 0;
$email->IsSMTP();
$email->Host = 'smtp.mail.yahoo.com';
$email->SMTPSecure = 'ssl';
$email->Port = 465;
$email->SMTPAuth = true;
$email->Username = "bosu_cse2k5";
$email->Password = "***********";
$output = '<html><body><form>';
$output .= '<table border="1"><tr><th>Author</th><th>Node Title</th><th>Node Summary</th><th>Node Body</th><th>Edit this node</th><th>Report Abuse</th><th>Group</th></tr>';
$output .= '</table></form></body></html>';
//print $output;
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-Type: text/html; charset=ISO-8859-1' . "\r\n";
$email->From = 'bosu_cse2k5@yahoo.com';
$email->FromName = 'Basudev';
$email->Subject = 'test';
$email->Body = $output;
$email->AddAddress( 'basudev.sadhu@bkash.com' );
if(!$email->Send())
{
echo 'Mailer Error: ' . $email->ErrorInfo;
}
else
{
'Mail send successfully';
}
答案 0 :(得分:1)
答案 1 :(得分:0)
将“echo”添加到“if(!$ email-&gt; Send())”的else部分。