Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Send mail notifications via Gmail
#1
I require to also send out mail notifications via Gmail/Google Apps. The mail settings today do not permit that. Any easy ways this can be achieved?

Thanks
Srini
Reply
#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:
require_once('../PHPMailer/class.phpmailer.php'); 

in the class I added

PHP Code:
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:
return (mail($recipient->getEmail(), $this->replaceMarker($subject), $this->replaceMarker($message), $header) ? : -1); 
changed to
PHP Code:
return ($this->mail($recipient->getEmail(), $this->replaceMarker($subject), $this->replaceMarker($message), $header) ? : -1); 

have fun
rainer

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)