【发布时间】:2010-12-29 00:20:26
【问题描述】:
当我尝试通过 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.';
}
?>
【问题讨论】:
-
你得到什么错误信息?
-
无法实例化邮件功能@Pekka
-
@Rajasekar - 这听起来不像是真正的错误消息,因为无法实例化函数。你能复制准确的错误输出吗?
-
邮件发送错误 - 无法实例化邮件功能
-
在 IIS 中,php 不使用二进制邮件程序,因此它依赖于安装的 MTA(即您需要以 SMTP 服务器为目标)。