NitheesBavesh
NitheesBavesh

Reputation: 163

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'=>'[email protected]',
           '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('[email protected]', '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

Upvotes: 1

Views: 962

Answers (1)

Gautham.M
Gautham.M

Reputation: 458

Tru this this may help to you

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

Upvotes: 1

Related Questions