我已经写了一些代码来发送电子邮件。现在,我有多个使用PHPMailer发送电子邮件的脚本。所以我所做的是,在包含PHPMailerAutoLoad.php之后,我将所有的SMTP设置写在一个文件中,但是它仍然抛出一个错误'Class PHPMailer not found.‘’。
以下是mailsetting.ph的代码片段,其中包含有关我的SMTP服务器的设置。
<?php
include("/../PHPMailer/PHPMailerAutoload.php");
$mail= new PHPMailer;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'username';
$mail->Password = 'password';
$mail->Port =465;
$mail->SMTPSecure = 'ssl';
$mail->From='info@vishalkhare.com';
$mail->FromName='Vishal Khare';
$mail->addReplyTo('info@vishalkhare.com', 'Information');
?>它显示‘致命错误:在第3行的mailsetting.php中找不到类'PHPMailer’,这显然意味着include语句正在正确执行。但是仍然没有包含PHPMailer类。我还尝试包含class.phpmailer.php文件
<?php
include("../class.phpmailer.php");
include("../PHPMailer/PHPMailerAutoload.php");
?>它仍然不起作用。请帮帮我,让我知道怎样才能在文件中包含PHPMailer类?
附注-它在XAMPP服务器上工作,但当我将代码移动到P.S服务器上时,它不工作。一个精准的godaddy服务器
发布于 2016-12-16 18:15:55
问题不在加载PHPMailAutoLad。不幸的是,谷歌爸爸不支持电子邮件的gmail,雅虎,美国在线,直播,hotmail等,如果您正在使用linux cPanel主机面板,然后在您的php文件中进行这些更改
$mail->Host = 'localhost';
$mail->Port = 25;
$mail->ssl = false;
$mail->authentication = false;https://stackoverflow.com/questions/37713449
复制相似问题