在 yii 中,我正在使用邮件扩展创建 actionEmail 方法。它将接受四个参数,分别是 FromEmail、ToEmail、Subject 和 Message。为了检查输出,我正在发送参数的硬编码值。
public function actionCreate($FromEmail='abc@gmail.com',$ToEmail='xyz@gmail.com',$Subject='Project',$Message='Hiee')
{
//using mailer extension
$mailer = Yii::createComponent('application.extensions.mailer.EMailer');
$mailer->IsSMTP();
$mailer->IsHTML(true);
$mailer->SMTPAuth = true;
$mailer->SMTPSecure = "ssl";
$mailer->Host = "smtp.gmail.com";
$mailer->Port = 465;
$mailer->CharSet = 'UTF-8';
//$mailer->Username = "abc@shailani.com";
$mailer->Password = "abc";
$mailer->From = $FromEmail;
$mailer->FromName = "Balaee.com";
//$mailer->AddAddress('shilpakirad@gmail.com');
$mailer->AddAddress($ToEmail);
$mailer->Subject = $Subject;
$mailer->IsHTML(true);
// $html = $this->renderPartial('myview',array('content'=>'Hello World'),true);
$mailer->Body=$Message;
if($mailer->Send()) {
echo "Please check mail";
}
else {
echo "Fail to send your message!";
}
}
我在用户控制器中创建了这个方法。但它没有执行。请帮我