Mail Notification

Hi All

I have some problem:

  1. Uploading multiple file, how to save multiple file into one row of my table (i’m using CmultiFileUpload, but when i save it into database it always create new record with different id, what i want is saving into database with one id).

  2. When i save that file, i want all of the member got mail notification. (i’m using some extension but it wont sent any email at all)

Actually what is wrong with my code?

heres my controller code for saving file:

public function actionCreateNagoya()

{


$model=new Content;


    // Uncomment the following line if AJAX validation is needed


// $this->performAjaxValidation($model);


$images = CUploadedFile::getInstancesByName('attachment');


       if(isset($images) && count($images) > 0)    


        {


	if(isset($_POST['Content']))


	


	$model->attributes=$_POST['Content'];


		


            foreach ($images as $i=>$ii) 


            {


						


	$model->setIsNewRecord(true);


	$model->setIsNewRecord(true);                    


            $model->id=null;                    


            $model->attachment = $ii;               


            $model->save();                  


            $model->attachment->saveAs(Yii::app()->basePath.'/attachment/'.$model->attachment);


	}


	$this->redirect(array('adminNagoya'));


        	}


	$this->render('createNagoya',array(


		'model'=>$model,


	));


}

public function afterSave( ) {

$this->sendMail( );


parent::afterSave( );

}

public function sendMail( ) {

$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->Username = "mymail@gmail.com";


 	$mailer->Password = 'mypassword';


 	$mailer->From = "mymail@gmail.com";


 	$mailer->FromName = "Portal Admin";


 	$mailer->AddAddress("destination@gmail.com");


 	$mailer->Subject = "Notification.";


 	$mailer->Body = "There's Some Data Have Been Uploaded.";


 	if(!$mailer->Send()) 


 	{


      	echo "Fail to send your message!";


 	}


 	else 


 	{


      echo "Message sent successfully!";


 	}

}

Would you all figure whats wrong with that code

[color="#006400"]/* moved from Miscellaneous */[/color]

Could you maybe put the code in code tags?

Just select it and click the ‘<>’ button. Makes it so much easier to read. :)

That did nt work either for me… try to configure pear mail extension… It worked for me…

try these links:

http://www.authsmtp.com/php-pear-mail/index.htm

http://www.phpmaniac.net/wiki/index.php/Pear_Mail

http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm

http://pear.php.net/package/Mail/redirected