嘿,我正在使用 PHPMailer 发送一些简单的电子邮件,但是 SetFrom() 函数似乎不起作用,即使我使用的代码直接来自 phpmails 文档(http://phpmailer.worxware.com/index .php?pg=examplebmail )
这是我的错误
Call to undefined method PHPMailer::SetFrom()
和我的剧本
require_once('inc/phpmailer/class.phpmailer.php');
$mail = new PHPMailer(); // defaults to using php "mail()"
$body = $message;
$mail->SetFrom('tell-a-friend@domain.com', 'tell a friend');
$mail->AddAddress($to_email, $to);
$mail->Subject = "tell a friend";
$mail->MsgHTML($body);
$mail->Send();
有任何想法吗?
编辑
原来 SetFrom() 函数在我的 phpmailer 版本中不存在,我可以使用设置这些值
$mail->From = '';
$mail->FromName = '';