简体   繁体   中英

yii smtp mail extension web application error

In my yii config file I used the following smtp configuration settings:

'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. 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. Please help me. Thanks

Tru,这可能对您有帮助

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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