php实例化com报错,php – 无法实例化邮件功能 为什么这个错误发生

当我尝试通过PHPMailer发送邮件时,我收到此错误消息。我的代码如下:

require("phpmailer/class.phpmailer.php"); // First we require the PHPMailer libary in our script

$mail = new PHPMailer(); // Next we create a new object of the PHPMailer called $mail

$mail->From = "rajasekar.kcet@gmail.com";

$mail->FromName = "Rajasekar";

$mail->AddAddress("rajasekar.kcet@gmail.com"); // This is the adress to witch the email has to be send.

$mail->Subject = "First PHP Email message"; // This is the subject of the email message.

$mail->Body = "Hi! \n\n This is my first e-mail sent through PHP."; // This is the actual email message

if(!$mail->Send()) // Now we send the email and check if it was send or not.

{

echo 'Message was not sent.';

echo 'Mailer error: ' . $mail->ErrorInfo;

}

else

{

echo 'Message has been sent.';

}

?>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值