コード例 #1
0
 /**
  * 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;
 }
コード例 #2
0
    echo "{$studentID}";
    echo "EMP ID :{$row['stu_job_id']}  <br> " . "EMP NAME : {$row['interview_date']} <br> " . "EMP SALARY : {$row['employer_id']} <br> " . "--------------------------------<br>";
    $studentID = $row['stu_job_id'];
}
echo "Fetched data successfully\n";
//$mail = new PHPMailer;
//$mail = new PHPMailer('passwordReset');
$mail = new YiiMailer('passwordReset', array('tempPassword' => $tempPassword));
//$mail = new YiiMailer('passwordReset');
$mail->isSMTP();
$mail->Host = 'smtp.teksavvy.com';
$mail->Port = 25;
//$mail->SMTPAuth = true;
//$mail->Username = '******';
//$mail->Password = '******';
//$mail->SMTPSecure = 'tls';
$mail->From = '*****@*****.**';
$mail->FromName = 'Admin';
$mail->addAddress('*****@*****.**', 'Mohammed Akbar');
//$mail->addReplyTo('*****@*****.**', 'Raj Amal W');
$mail->WordWrap = 50;
$mail->isHTML(true);
$mail->Subject = 'Interview notifier - You have interview tomorrow';
$mail->Body = "Hi  student Id: , <br>\nYou have an interview with employee id:<br>.\n\nThis is a system generated interview notifier <br>. \nGood luck <br>\n\nThank you <br>\n\nCollege Corner Stone <br>\nAdmin\n";
if (!$mail->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
    exit;
}
echo 'Message has been sent';
mysql_close($conn);