hi all,
I need a help on sending mail in background process. Actually the problem is that the sanding controller did not renders the page until the message is sent. m using YIIMAILER extension.
Problem is that i want mail is send after the page renders. pls help …
if any have suggetions or link pls forward to me … pls try to do this without extensions.
[indent] I am making a non-profit site. Here when the user wants to contact me, an E-mail is sent to him that “Your contact request is recvd. we’ll reply u soon”. [/indent]
public function actionEmail(){
$mail= new YiiMailer();
// SETTINGS===========================//
$mail->IsSMTP(); // send via SMTP
$mail->Host = "smtp.gmail.com";
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "xxx@gmail.com"; // SMTP username
$mail->Password = "xxxxxxx"; // SMTP password
$webmaster_email = "xxxxx"; //Reply to this email ID
$mail->From = $webmaster_email;
$mail->FromName = "xxx";
$email= $model->email; // Recipients email ID
$recname=$model->name ; // Recipient's name
$mail->AddAddress($email,$recname);
$mail->AddReplyTo($this->webmaster_email ,"xxx");
$mail->WordWrap = 50; // set word wrap
//Send Mail
$mail->IsHTML(true); // send as HTML
$mail->Subject = $model->subject;
$mail->Body = $model->body."And Dated On".$model->tdate; //HTML Body
$mail->AltBody = "This is the body when user views in plain text format"; //Text Body
Yii::app()->user->setFlash('contact','Thank you for contacting us. We will respond to you as soon as possible.');
$this->render('contact',array('model'=>$model));
$mail->send();
}
Thank u.