简体   繁体   English

yii smtp邮件扩展Web应用程序错误

[英]yii smtp mail extension web application error

In my yii config file I used the following smtp configuration settings: 在我的yii配置文件中,我使用了以下smtp配置设置:

'Smtpmail'=>array(
           'class'=>'application.extensions.smtpmail.PHPMailer',
           'Host'=>"secure.emailsrvr.com",
           'Username'=>'admin@obusiness.com',
           'Password'=>'admin',
           'Mailer'=>'smtp',
           'Port'=>465,
           'SMTPAuth'=>true, 
           'SMTPSecure' => 'tls',
       ),

In controller file I used the following code to send the mail 在控制器文件中,我使用以下代码发送邮件

$subject = UserModule::t("You have requested the password recovery site {site_name}",
$message = UserModule::t("You have requested the password recovery site {site_name}. To receive a new                            password, go to {activation_url}.",
$user->office_mail;
      $mail=Yii::app()->Smtpmail;
$mail->SetFrom('office@optisol.com', 'From NAme');
$mail->Subject    = $subject;
$mail->MsgHTML($message);
$mail->AddAddress($user->office_mail);
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
}else {
echo "Message sent!";
}

I use SMTP mail extension to send mail using the above code. 我使用SMTP邮件扩展名通过上述代码发送邮件。 I have received the following error message 我收到以下错误信息

"Property "CWebApplication.Smtpmail" is not defined"

I searched about this error in google, but I couldn't find the exact solution. 我在google中搜索了此错误,但找不到确切的解决方案。 Please help me. 请帮我。 Thanks 谢谢

Tru,这可能对您有帮助

http://www.yiiframework.com/extension/smtp-mail/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM