Ich schicke eine Mail mit PHP-Mailer-Bibliothek.Ich möchte HTML-Ausgabe in E-Mail-Text senden. Mail wird erfolgreich gesendet, aber die Ausgabe wird nicht richtig angezeigt. Der vollständige HTML-Code wird angezeigt. Unten ist mein Code. Kann mir jemand helfen?
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" . "rn";
$headers .= "Content-Type: text/html; charset=ISO-8859-1" . "rn";
$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";
}
Antworten:
1 für die Antwort № 1Versuche zu setzen
$email->IsHTML(true);
für mehr detailbesuch https://github.com/PHPMailer/PHPMailer
0 für die Antwort № 2
Fügen Sie "echo" zum else-Teil von "if (! $ Email-> Send ())" hinzu.