you're reading...

Joomla and Gmail How To

A couple of weeks ago, I decided to use Gmail as SMTP server to send emails from my Joomla website. Here is explained what I did to make everything working.

First of all, I edited my configuration.php file to contain the following settings:

	var $mailer = 'SMTP Server';
	var $mailfrom = 'MY_GMAIL_ADDRESS';
	var $smtpauth = '1';
	var $smtpuser = 'MY_GMAIL_ADDRESS';
	var $smtppass = 'MY_GMAIL_PASSWORD';
	var $smtphost = 'ssl://smtp.gmail.com:465';

Then, I patched the libraries/phpmailer/phpmailer.php file by editing the SmtpConnect function. In the specific I changed the lines:

if(strstr($hosts[$index], ":"))
        list($host, $port) = explode(":", $hosts[$index]);


if (preg_match('#(([a-z]+://)?[^:]+):(\d+)#i', $hosts[$index], $match))
        $host = $match[1];
        $port = $match[3];

Please note that I’m using Joomla version 1.5.6. This trick is based on the following discussion.

About Roberto Aloi

Software Engineer and Erlanger. Author of www.tryerlang.org.


No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: