WordPress send email via GMails SMTP servers

WordPress 2.6 can be modified so that is uses GMails SMTP servers (if you have a GMail account!) to send out email. The hack is really not difficult and involves the following:

Modify wp-includes/class-phpmailer.php

155
    var $Host        = "ssl://smtp.gmail.com";
161
    var $Port        = 465;
167
    var $Helo        = "yourhostname.com";
173
    var $SMTPAuth     = true;
179
    var $Username     = "your gmail email address";
185
    var $Password     = "your password";
536
537
538
/*            if(strstr($hosts[$index], ":"))
                list($host, $port) = explode(":", $hosts[$index]);
            else */

And than modify: wp-includes/pluggable.php

355
356
	$phpmailer->FromName = apply_filters( 'wp_mail_from_name', $from_name );
        $phpmailer->Sender = apply_filters( 'wp_mail_from', $from_email );
378
    $phpmailer->IsSMTP();

One thought on “WordPress send email via GMails SMTP servers”

Leave a Reply

Your email address will not be published. Required fields are marked *