【求助】phpmailer 发送失败 ,贴出问题求包养 [ 新手入门 ]
public function sendEmail($params = array())
{
$params = array(
'smtpHost'=>'smtp.qq.com',
'fromAddress'=>'admin@yxol.org', //我用的是qq的域名邮箱
'myname'=>'Yxol.org',
'sendPassword'=>'*******',
'replyAddress'=>'admin@yxol.org',
'sendAddress'=>'9583738@qq.com',
'title'=>'测试...',
'content'=>'内容...',
);
if (is_array($params) && !empty($params))
{
Yii::app()->mailer->Host = $params['smtpHost'];
Yii::app()->mailer->IsSMTP();
Yii::app()->mailer->From = $params['fromAddress'];
Yii::app()->mailer->FromName = $params['myname'];
Yii::app()->mailer->Password = $params['sendPassword'];
Yii::app()->mailer->SMTPDebug = true;
Yii::app()->mailer->AddReplyTo($params['replyAddress']);
Yii::app()->mailer->AddAddress($params['sendAddress']);
Yii::app()->mailer->Subject = $params['title'];
Yii::app()->mailer->Body = $params['content'];
if(!Yii::app()->mailer->Send())
{
return false;
}
else
{
return true;
}
}
else
{
return false;
}
}
提示出错内容: Could not instantiate mail function. 邮件发送失败. 错误原因: Could not instantiate mail function.
共 4 条回复
yxmjc 湖北黄石
注册时间:2011-03-25
最后登录:2014-04-05
在线时长:0小时0分
最后登录:2014-04-05
在线时长:0小时0分
- 粉丝0
- 金钱50
- 威望0
- 积分50