<< Back
Message for this thread
Posted by Messages text
Armstrong John

Noavatar
Total post : 13
> Profile
Written on : 09/10/2011 22:32 ( more than one month )
Object : Gmail Hack
Hi everyone,
  I needed to relay via gmail so I updated phpMailer and config.ini to allow for this. It a trivial change but hopefully this helps someone else. Gmail requires TLS and php mailer has to be told to move into secure mode. I should have made this more generic for any ssl/tls service but for now this works me and maybe you as well.

---config.php---
$cfg['use_gmail'] = 'on';
$cfg['smtp_debug'] = 2;


--lib/lib.mailer.php---
 start on line 176 replace your use_smtp block with this one (only a few changes)

               if ($use_smtp == 'on') {
                        $this->IsSMTP();
                        $this->Hostname = Get::cfg('smtp_host');
                        $this->Host = Get::cfg('smtp_host');
                        $smtp_user =Get::cfg('smtp_user');
                        $use_gmail = Get::cfg('use_gmail');
                        $smtp_debug = Get::cfg('smtp_debug');
                        if (!empty($smtp_user)) {
                                $this->Username = $smtp_user;
                                $this->Password = Get::cfg('smtp_pwd');
                                $this->SMTPAuth = true;
                        } else {^M
                                $this->SMTPAuth = false;
                        }^M     
                        if(!empty($use_gmail)){
                                $this->SMTPSecure = "tls";
                                $this->Port     = 587;  
                        }       
                        if(!empty($smtp_debug)){
                                $this->SMTPDebug = $smtp_debug;
                        }       
                        error_log("AUTH:".$this->SMTPAuth);
                } else {
                        $this->IsMail();
                }


 
 
<< Back