我正在使用 phpMailer 自动向特定用户发送邮件,但它向我抛出错误“致命错误:未捕获错误:调用 F:\WebServer\htdocs\Module15\index.php:14 中未定义的方法 PHPMailer::setForm()堆栈跟踪:#0 {main} 抛出”。谁能帮我解决这个问题。
这是我的代码:
索引.php
<?php
require 'phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail -> SMTPDebug = 1;
$mail->HOST='smpt.gmail.com';
$mail->Port=587;
$mail->SMTPAuth=true;
$mail->SMTPSecure='tls'
$mail->Username='name@gmail.com';
$mail->Password='444';
$mail->setForm('name@gmail.com', 'Tariq Shaikh');
$mail->addAddress('name1@gmail.com');
$mail->addReplyTo('name@gmail.com');
$mail->isHTML(true);
$mail->Subject='Notification';
$mail->Body='<h2 align=center>A new Audit Form has been Uploaded by Faculty.</h2><h3 align=center>Please check your Notification</h3>';
if (!$mail->send()) {
echo "ERROR! Email is not sent!";
}
else{
echo "Email has been sent successfully";
}
?>
慕妹3242003