我收到內部服務器錯誤,當我使用PHP郵件從網頁發送電子郵件/我didn找不到任何解決方案,我不知道如何在Bigrock服務器中配置郵件以使PHP郵件程序正常工作。PHP致命錯誤:類'SMTP'找不到在/ home/screcafb/public_html/class.phpmailer.php在線1520
這是代碼。
<?php
if(isset($_POST['submit']))
{
require 'PHPMailerAutoload.php';
ini_set('SMTP','localhost');
ini_set('sendmail_from', '[email protected]');
$to="[email protected]";
$fromrec=$_POST['from'];
$from="[email protected]";
$subject=$_POST['sf'];
$message=$_POST['message'];
$mail->isSMTP();
$mail = new PHPMailer;
$mail->setFrom($from, 'test');
$mail->addAddress($to);
$mail->Subject = $subject;
$mail->Body = "From:".$fromrec."".$message;
if(!$mail->send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent.';
}
}
?>
日誌中的錯誤是:
[30-May-2017 19:08:10 Etc/GMT] PHP Fatal error: Class 'SMTP' not found in /home/screcafb/public_html/class.phpmailer.php on line 1520
檢查服務器日誌,它會顯示錯誤消息。 – Barmar