Written by Marco Conti Thursday, 06 August 2009 12:30
Have you ever tried to use Joomla email features in a Localhost Installation? Here's how!
I often like to work on my Joomla web sites in my "localhost" server. On my Mac I use MAMP while on my PC I use XAMPP. Both are excellent PHP, Apache and MySql implementations that allow running a PHP based web script directly on a local computer. There are many advantages to doing that. Development is more immediate, response is faster and editing the files is more direct.
However, if you need to test any email related scripts, such as Newsletter components or any Joomla Component or plugin that sends emails as a result of user interaction you'll know that your localhost is not equipped to work as a mail server.
Both XAMPP and MAMP have options where you can set up a local mail server, but to say that the configuration is complex is an understatement. XAMPP comes with Mercury Mail and it took me hours to finally make it work. Only to have my computer crash on me and having to start from scratch.
The other day I was talking with one of my online students about some of the basic points of my Joomla-Dreamweaver integration method (for which I hope I'll have a book coming out soon) and specifically how to run a "localhost" based Joomla installation using the same files as the remote installation.
My student rightly pointed out that while the system works fine for much of the Joomla functionality, email is an issue.
Like me, she didn't want to waste time setting up a local mail server only for the sporadic Joomla based application.
At that point I had one of those "Eureka" moments. I went back to one of my local Joomla installations and I started messing around with Joomla's configuration settings.
You'll have noticed that in the "Server" tab of the Joomla Global Configuration there is a pane called "Mail Settings".
By and large, most people leave those setting to their default, which is "PHP Mail Function". However, there are 3 settings available altogether:
Setting #3 actually uses an SMTP mail server in a way similar to a regular email program like MS Outlook or Mozilla Thunderbird.
I am not sure why I thought about SMTP Server only now, after years of working on Joomla in a localhost configuration, but I suspect many others are in the same situation. It's just one of those things that doesn't seem important until you need it.
So I went ahead and set up the SMTP Server option in my localhost built using one of my @conticreative.com email addresses. I entered the username and password, I entered the mailserver address (which in my case is mail.conticreative.com) and I tested the mail function using the "Mass Mail" feature built in Joomla.
IT WORKED!
I am not sure why I was so excited about it, after all, that's what it is supposed to do. But after assuming for so many years that it was impossible to test emails on a localhost installation of Joomla, it seemed like a momentous revelation.
In any event, now all my localhost installations are able to work with emails for testing purposes without having to become an expert on mail server administration.
I am sure that many others have figured this out a long time ago and yes, I am ashamed it took me so long to find this trick out, but better late than never, I guess.
If you have been struggling with the same issue (meaning you are as big an idiot as I am) here is a step by step list on how to set and test your localhost Joomla to use SMTP:

Enter your email username (on Cpanel server is "name+domain.com" or your email address with a "plus" (+) sign instead of the "at" (@) sign)If you did everything right it should work just fine.
Here is what the "Mail Settings" interface looks like in Joomla 1.5.14:
and this is what it looked like in previous versions (this is a screenshot from Joomla 1.5.10):
As you can se, it's not very hard to set your localhost email in Joomla. I have not had a chance to test it in every possible situation, but Mass Mail works just fine as does a form I have been testing using Phil Taylor's "Joomla Forms".
I certainly hope you are not glazed over by now or bored to death for reading something that to you was a given. It wasn't for me and according to the many forum posts I read over the years in the Joomla forums there are many others in the same boat as I was.
Thank you for reading this post and I hope you found it useful.
Until next time - Marco
Do you have Joomla! or Web Development questions you would like us to answer in our 10 Minute Joomla! Tips Screencast or one of our our blogs?
Contact us or email
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
| < Prev | Next > |
|---|
Conticreative offers Individual and Corporate training (in person or online) on Joomla, Wordpress, Zen Cart and other leading Open Source scripts.