Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Send mail notifications via Gmail
#2
download PHPMailer from http://code.google.com/a/apache-extras.o...loads/list and add a folder called PHPMailer in the docRootOfLetoDMS

I changed file inc/inc.ClassEmail.php

add after line 19
PHP Code:
<?php 
require_once('../PHPMailer/class.phpmailer.php');

in the class I added

PHP Code:
<?php 
function mail($recipient, $subject, $message, $header){
$recList = split(',', $recipient);
$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
$mail->IsSMTP(); // telling the class to use SMTP
try {
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "rainer@example.com"; // GMAIL username
$mail->Password = "password"; // GMAIL password
$mail->AddReplyTo('barbara@example.net', 'ReplyToMe');
foreach (
$recList as $value) {
$mail->AddAddress($value, $value);
}
$mail->SetFrom('barbara@example.net', 'myDMS');
$mail->Subject = $subject;
$mail->Body = $message;
$mail->Send();
} catch (
phpmailerException $e) {
echo
$e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo
$e->getMessage(); //Boring error messages from anything else!
}
}

lines like
PHP Code:
<?php 
return (mail($recipient->getEmail(), $this->replaceMarker($subject), $this->replaceMarker($message), $header) ? 0 : -1);
changed to
PHP Code:
<?php 
return ($this->mail($recipient->getEmail(), $this->replaceMarker($subject), $this->replaceMarker($message), $header) ? 0 : -1);

have fun
rainer

Reply


Messages In This Thread
Send mail notifications via Gmail - by ssrini - 01-08-2012, 10:11 AM

Forum Jump:


Users browsing this thread: