如何修复未定义的方法PHPMailer :: AddAdress()错误? [英] How to fix undefined method PHPMailer::AddAdress() error?

查看:77
本文介绍了如何修复未定义的方法PHPMailer :: AddAdress()错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个PHP邮件脚本,并且正在使用phpmailer.我收到错误消息:

I am making a PHP mail script, and I'm using phpmailer for it. I get the error:

严重错误:调用未定义方法PHPMailer :: AddAdress()

Fatal error: Call to undefined method PHPMailer::AddAdress() in

这是我的代码:

if (empty($errors)) {

$m = new PHPMailer;

$m->isSMTP();
$m->SMTPAuth = true;

$m->SMTPdebug = 2;

$m->Host = 'smtp.gmail.com';
$m->Username = 'email@gmail.com';
$m->Password = '******'
$m->SMTPSecure = 'tls';
$m->Port = 465;

$m->isHTML();

$m->Subject = 'Contact form submitted';
$m->Body = 'From: ' . $fields['name'] . ' (' . $fields['email'] . ')<p>' . $fields['message'] . '</p>';

$m->FromName = 'Contact';

$m->AddAdress("email@gmail.com", "Name");

if ($m->send()) {
    header('Location: thanks.php');
    die();
} else {
 $errors[] = 'sorry, could not send';
}

推荐答案

您在方法中错过了一个 d
使用$m->AddAddress(recipientMailAddress [, recipientName]);

You've missed one d in your method
Use $m->AddAddress(recipientMailAddress [, recipientName]);

这篇关于如何修复未定义的方法PHPMailer :: AddAdress()错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆