我是 PHPMailer 的新手,我想用这个类发送 HTML 邮件。但我得到的消息是身体是空的。
这是我的代码:
<?php
$bericht .= 'my html and php code that format the mail';
require_once('class.phpmailer.php');
$mail = new PHPMailer(); // defaults to using php "mail()"
$body = preg_replace('/[\]/','',$bericht);
$mail->SetFrom('email@adres', 'Name');
$address = "email@adres";
$mail->AddAddress($address, "");
$mail->Subject = "PHPMailer Test Subject via mail(), basic";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
我究竟做错了什么?