Background Process / Action / Procedures

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 = "";

		$mail->SMTPSecure = 'tls';

		$mail->SMTPAuth = true; // turn on SMTP authentication

		$mail->Username = ""; // 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->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.');




Thank u.

if u have seen this type of topic before kindly send me that link

You need to use a cron job (on Unix like operating systems) to trigger email sending periodically. You’ll need to save the unset message in some sort of queue. Check this wiki article for some ideas.

Probably save the email information to a table instead of sending it. then like Keith said us a cron job (scheduled Task in Win) to run every x-minutes to do the actual sending.

thank u @Keith & @jkofsy

It helps …