/** * does the publication for a once round * * @param integer $id * @return number */ public function actionPublish($id) { /*$mail = new YiiMailer('contact', array('message' => 'Message to send', 'name' => 'John Doe', 'description' => 'Contact form')); $mail->setFrom('*****@*****.**', 'Jesus Nataren'); $mail->setTo(Yii::app()->params['adminEmail']); $mail->setSubject('Proxima Jornada');*/ $matchGame = MatchGame::model()->findByPK($id); if ($matchGame === null) { throw new CHttpException(404, 'The requested page does not exist.'); } $mail = new YiiMailer(); //$mail->clearLayout();//if layout is already set in config /*$mail->setFrom('*****@*****.**', 'Jesus Nataren'); $mail->setTo(Yii::app()->params['adminEmail']); $mail->setSubject('Mail subject'); $mail->setBody('Simple message'); $mail->send();*/ //Tell PHPMailer to use SMTP $mail->isSMTP(); //Enable SMTP debugging // 0 = off (for production use) // 1 = client messages // 2 = client and server messages $mail->SMTPDebug = 0; //Ask for HTML-friendly debug output //$mail->Debugoutput = 'html'; //Set the hostname of the mail server //$mail->Host = 'mail.google.com'; //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission //$mail->Port = 465; $mail->Host = 'smtp.gmail.com'; //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission $mail->Port = 587; //Set the encryption system to use - ssl (deprecated) or tls //$mail->SMTPSecure = 'ssl'; //Set the encryption system to use - ssl (deprecated) or tls $mail->SMTPSecure = 'tls'; //Whether to use SMTP authentication $mail->SMTPAuth = true; //Username to use for SMTP authentication - use full email address for gmail $mail->Username = "******"; //Password to use for SMTP authentication $mail->Password = "******"; //Set who the message is to be sent from $mail->setFrom('*****@*****.**', 'Jesus Nataren'); //Set an alternative reply-to address //$mail->addReplyTo('*****@*****.**', 'First Last'); //Set who the message is to be sent to $mail->addAddress('*****@*****.**', 'Jesus Nataren'); //Set the subject line $mail->Subject = 'PINFO SYSTEM. Programacion de fechas'; //Read an HTML message body from an external file, convert referenced images to embedded, //convert HTML into a basic plain-text alternative body $mail->msgHTML('<html><body><H1>Publicacion de jornada <small>2</small></H1><body></html>'); //Replace the plain text body with one created manually //$mail->AltBody = 'This is a plain-text message body'; //Attach an image file //send the message, check for errors if ($mail->send()) { Yii::app()->user->setFlash('info', '<strong>Publicado. </strong>Se envio email a los participantes del torneo. '); $matchGame->STATUS = 4; $matchGame->save(); } else { Yii::app()->user->setFlash('error', '<strong>Error. </strong>No se envio el email. '); //$mail->ErrorInfo); } $this->redirect(array('manageMatchs', 'id' => $matchGame->TOURNAMENT_ID)); //return 1; }