Exemple #1
0
 public function Mailer($recipient, $subject = null, $message, $headers = null)
 {
     $mail = new Model_PHPMailer();
     $mail->Host = "retail.smtp.com";
     // SMTP server
     //$mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
     // 1 = errors and messages
     // 2 = messages only
     $mail->SMTPAuth = true;
     // enable SMTP authentication
     $mail->Port = 2525;
     // set the SMTP port for the GMAIL server
     $mail->Username = "******";
     // SMTP account username
     $mail->Password = "******";
     // SMTP account password
     $mail->SetFrom('*****@*****.**', 'EazyFashion');
     $mail->Subject = $subject;
     //$mail->AddAddress($recipient, "EazyFashion Customer");
     $mail->AddAddress("*****@*****.**", "EazyFashion Admin");
     //$mail->AddAddress("*****@*****.**", "EazyFashion Admin");
     $body = $message;
     $mail->MsgHTML($body);
     if (!$mail->Send()) {
         return "Mailer Error: " . $mail->ErrorInfo;
     } else {
         return "Message sent!";
     }
 }
 public function testAction()
 {
     $mail = new Model_PHPMailer();
     $mail->Host = "retail.smtp.com";
     // SMTP server
     //$mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
     // 1 = errors and messages
     // 2 = messages only
     $mail->SMTPAuth = true;
     // enable SMTP authentication
     $mail->Port = 2525;
     // set the SMTP port for the GMAIL server
     $mail->Username = "******";
     // SMTP account username
     $mail->Password = "******";
     // SMTP account password
     $mail->SetFrom('*****@*****.**', 'EazyFashion');
     //$mail->AddReplyTo("*****@*****.**","First Last");
     $mail->Subject = "PHPMailer Test Subject via smtp, basic with authentication";
     $mail->AddAddress('*****@*****.**', "Jay Fajardo");
     $body = 'test broadcast';
     $mail->MsgHTML($body);
     if (!$mail->Send()) {
         echo "Mailer Error: " . $mail->ErrorInfo;
     } else {
         echo "Message sent!";
     }
     exit;
 }