使用PHP版本6.0.6
我知道类似的问题也有答案,但我的情况不同。我已经成功地配置了脚本,它运行得非常好;我正在接收邮件,然后突然之间,没有从我身边发生任何更改,它开始抛给我这个错误。
错误
[Sun Nov 25 21:49:37.852920 2018] [:error] [pid 2060:tid 780] [client ::1:59300]
PHP Fatal error: Uncaught Error: Class 'PHPMailer\\PHPMailer\\Exception' not found in E:\\TCi\\htdocs\\sdresidency\\website\\plugins\\PHPMailer\\PHPMailer.php:1920\nStack trace:\n#0 E:\\TCi\\htdocs\\sdresidency\\website\\plugins\\PHPMailer\\PHPMailer.php(1774): PHPMailer\\PHPMailer\\PHPMailer->smtpConnect(Array)\n#1 E:\\TCi\\htdocs\\sdresidency\\website\\plugins\\PHPMailer\\PHPMailer.php(1516): PHPMailer\\PHPMailer\\PHPMailer->smtpSend('Date: Sun, 25 N...', 'This is a multi...')\n#2
E:\\TCi\\htdocs\\sdresidency\\website\\plugins\\PHPMailer\\PHPMailer.php(1352): PHPMailer\\PHPMailer\\PHPMailer->postSend()\n#3
E:\\TCi\\htdocs\\sdresidency\\website\\newbooking.php(38): PHPMailer\\PHPMailer\\PHPMailer->send()\n#4 {main}\n thrown in 这是我用来寄信的托辞。
require_once "plugins/PHPMailer/PHPMailer.php";
require_once "plugins/PHPMailer/SMTP.php";
$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail->IsSMTP(); // enable SMTP
//Enable SMTP debugging.
$mail->SMTPDebug = 0; // debugging: 1 = errors and messages, 2 = messages only
//Set PHPMailer to use SMTP.
$mail->IsSMTP(); // enable SMTP
//Set SMTP host name
$mail->Host = "md-in-30.webhostbox.net";
//Set this to true if SMTP host requires authentication to send email
$mail->SMTPAuth = true;
//Provide username and password
$mail->Username = "<my mail id>";
$mail->Password = "<my password>";
//If SMTP requires TLS encryption then set it
$mail->SMTPSecure = "tls";
//Set TCP port to connect to
$mail->Port = 587;
$mail->From = "<my mail id>";
$mail->FromName = "SD RESIDENCY";
$mail->addAddress("<receive mail id>", "name");
$mail->isHTML(true);
$mail->Subject = "NEW RESERVATION";
$mail->Body = $message;
$mail->AltBody = "No HTML Support";
if(!$mail->send())
{ $_SESSION['message'] = 'SOME ERROR OCCURED, PLEASE TRY AGAIN';}
else
{
$_SESSION['message'] = 'BOOKING COMPLETED SUCCESSFULLY';
header("Location: " . $_SERVER["HTTP_REFERER"]);
}我在$message变量中存储html格式的邮件内容。我已经在堆栈和其他网站尝试过所有答案的问题,但是没有运气,任何帮助都将是非常感谢的。
发布于 2018-11-25 19:30:15
require_once "plugins/PHPMailer/PHPMailer.php";替换为require_once "./plugins/PHPMailer/PHPMailer.php";
composer require phpmailer/phpmailer https://packagist.org/packages/phpmailer/phpmailerrequire 'vendor/autoload.php';
https://stackoverflow.com/questions/53469951
复制相似问题