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

时间:2014-06-18 05:37:30

标签: php email yii smtp yii-extensions

在我的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',
       ),

在控制器文件中,我使用以下代码发送邮件

$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!";
}

我使用SMTP邮件扩展名使用上述代码发送邮件。我收到以下错误消息

"Property "CWebApplication.Smtpmail" is not defined"

我在谷歌搜索了这个错误,但我无法找到确切的解决方案。请帮我。感谢

1 个答案:

答案 0 :(得分:1)

真的,这对你有帮助

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