我的 php 邮件程序功能遇到了这个问题。我尝试更改所需的文件,但仍然是一样的。谁能帮我解决这个错误。
这是我的 phpmailer 代码:
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = "smtp.gmail.com";
$mail->Port = 587;
$mail->IsHTML(true);
$mail->Username = "testnoreply@gmail.com";
$mail->Password = "test";
$mail->SetFrom("testnoreply@gmail.com");
$mail->Subject = "Membership expire notice";
$mail->Body = "Dear ICONIS member your membership is going to expire please renew it";
$mail->AddAddress($em);
if (!$mail->Send()) {
echo "Mailer Error: " .$mail->ErrorInfo;
} else {
echo "Mail has been sent";
}
最佳答案
你确定你的文件夹中同时有 class.phpmailer.php 和 class.smtp.php 吗?
尝试在包含 class.phpmailer.php 之前包含 class.smtp.php,如下所示:
<?php
include 'class.smtp.php';
include 'class.phpmailer.php';
// your code goes here
然后告诉你是否有错误。
关于php - 在 phpmailer 中找不到类 SMTP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29625285/