php - Alias "yii.swiftmailer" is invalid. Make sure it points to an existing directory or file -
i have configure yii2-swiftmailer according documentation when send mail showing error:
alias "yii.swiftmailer" invalid. make sure points existing directory or file.
c:\xampp\htdocs\hotel\protected\controllers\homecontroller.php(250) 246 247 public function actionmail() 248 { 249 250 yii::app()->mailer->compose() 251 ->setto('example@gmail.com') 252 ->setfrom('example2@gmail.com') 253 ->setsubject('invite') 254 ->settextbody('hello!') 255 ->send(); 256 257 } 258 }
and extension folder... extention\yii2-swiftmailer
and config:
'mailer' => [ 'class' => 'yii\swiftmailer\mailer', 'usefiletransport' => false,//set property false send mails real email addresses //comment following array send mail using php's mail function 'transport' => [ 'class' => 'swift_smtptransport', 'host' => 'smtp.gmail.com', 'username' => '', 'password' => '', 'port' => '587', 'encryption' => 'tls', ], ],
that because try use swiftmailer yii2 not version 1. try extension dedicated yii first version http://www.yiiframework.com/extension/swiftmailer/
Comments
Post a Comment