Tutorial – Sending email from WordPress using Google Gmail

This tutorial covers how you easily can modify your WordPress installation to send email with a Google Gmail account instead of sending through your webserver. Only ONE file needs to be modified. You also need to have a working WP-installation and a Gmail-account.

Step 1
Open the file ”wp-includes/class-phpmailer.php” (which is the class that sends email in WordPress) in your favourite text-editor.

Step 2
Find and modify the following properties.

var $Mailer = ’smtp’;
var $Host = ’smtp.gmail.com’;
var $Port = 465;
var $SMTPAuth = true;
var $Username = ’your_username@gmail.com’;
var $Password = ’your_gmail_password’;

Step 3
Find the the method ”IsMail” (in the same file) and comment out one row of code like this:

function IsMail() {
//$this->Mailer = ’mail’;

All steps complete!

This should work with all WordPress versions that uses a version of the phpMailer-class that is Gmail compatible.

Tested in WordPress v 2.7

I don’t use this method any longer because I don’t want to touch the core-files of wordpress. It is a bad habit to do so, because they get overwritten each time you update wordpress. There is a plugin called XPertMailer that can send email through gmail. Use that one instead!

4 reaktioner till “Tutorial – Sending email from WordPress using Google Gmail”


E-postadressen publiceras inte. Obligatoriska fält är märkta *

Denna webbplats använder Akismet för att minska skräppost. Lär dig hur din kommentardata bearbetas.