我正在使用對(duì)mail()用戶ID稍加修改的基本示例,但出現(xiàn)錯(cuò)誤“郵件錯(cuò)誤:無法實(shí)例化郵件功能”如果我使用郵件功能-mail($to, $subject, $message, $headers);它工作正常,盡管我在發(fā)送html時(shí)遇到問題,這就是為什么我嘗試使用PHPMailer的原因。這是代碼:<?phprequire_once('../class.phpmailer.php'); $mail = new PHPMailer(); // defaults to using php "mail()" $body = file_get_contents('contents.html'); $body = eregi_replace("[\]",'',$body); print ($body ); // to verify that I got the html $mail->AddReplyTo("reply@domain.com","my name"); $mail->SetFrom('from@domain.com', 'my name'); $address = "to@domain.com"; $mail->AddAddress($address, "her name"); $mail->Subject = "PHPMailer Test Subject via mail(), basic"; $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; $mail->MsgHTML($body); $mail->AddAttachment("images/phpmailer.gif"); // attachment $mail->AddAttachment("images/phpmailer_mini.gif"); // attachment if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message sent!"; }?>
phpmailer錯(cuò)誤“無法實(shí)例化郵件功能”
人到中年有點(diǎn)甜
2019-12-03 16:00:36