When building Joomla websites on localhost in Windows, you may have noticed that emails are not sent. This happens because your Windows machine is unlikely to have a SMTP server configured. In this article, we'll discuss how to overcome this by installing a free mail (SMTP) server emulator, allowing you to test and view emails sent by your Joomla website.

Being able to view emails that are sent by Joomla is extremely useful because it allows you test and debug mail sending features of your web site.

Depending how Joomla mail features are configured you may see one of the following error messages when Joomla tries to send email:

"Could not start mail function."

"Could not execute: /var/qmail/bin/sendmail"

"SMTP connect failed"

Test Mail Server Tool (for Windows)

Test Mail Server Tool is a really useful, free mail (SMTP) server emulator to test mail sending capabilities of Joomla (and other web applications). It is a great tool for web developers and designers who need a mail server for testing, but don't want to install one.

The program listens on localhost on an SMTP port (usually 25, but may be changed). All mail sent to this tool is automatically stored and optionally opened with your mail client.

The emails are never delivered to the specified email address. The mail is caught locally by the Test Mail Server Tool and shown in your own email client for testing purposes only.

#1 Download & Install Test Mail Server Tool

Download the Windows installation file from toolheap.com.

Download

Size: 383 KB
MD5 Checksum: 33e6135f75c2dfaf0596830daeaa51cf

Then open the TestMailServerToolSetup.exe file and install the program into Windows.

#2 Open Test Mail Server Tool

Now installed, you can start the tool from your Windows start button (or you may have a shortcut on your desktop).

 

Starting Test Mail Server Tool in Windows

 

Once the tool has started, a new icon will display in your system tray.

 

Test Mail Server Tool in the system tray

 

#3 Review Configuration

Click on the icon in the system tray to review the configuration.

 

Configure the Test Mail Server Tool

 

You can configure:

  1. The port to listen on for mail. By default this will be 25 and unless your change your localhost configuration you should keep this listening on port 25. 
  2. Select whether to open received email. I personally prefer this option enabled so I can immediately see emails as they are sent. The emails will be opened in your default mail client.
  3. The folder where received mail should be saved.

#4 Test in Joomla

Now you're ready to test in Joomla. You can do this by sending a new private message in your Joomla administrator.

Select any existing Joomla user, and enter any subject and message. Then click the Send button.

The email will then be sent and caught by the Test Mail Server Tool, and shown in your email client.

Pretty useful stuff!

If you enable this tool whilst building and developing websites, you will see all emails that are sent by Joomla as they are sent.

Alternative mail solutions for Joomla on localhost

Install a Windows Mail Server

You can install a mail server for Windows, such as hMailServer which is a free open source solution for Microsoft Windows. Running a fully operational mail server is more complicated and would take more system resources than using the simple Test Mail Server Tool above. Additionally, it means that emails are sent and delivered to email addresses, rather than just displayed locally for testing purposes.

Use Gmail as your Mail Server

If you have a Gmail account, you can use the Google service as your mail server in your Joomla website. In the Joomla Global Configuration, under the Server tab set the following for Mail Settings:

  • Mailer: SMTP
  • From Email: The email address you want in the 'from' field on emails sent from your website.
  • From Name: The name you want to in the 'from' field on emails sent from your website.
  • SMTP Authentication: Yes
  • SMTP Security: SSL
  • SMTP Port: 465
  • SMTP Username: Your gmail username
  • SMTP Password: Your gmail password
  • SMTP Host: smtp.gmail.com

Please be aware that using Gmail as your mail server will result in emails being sent and delivered to email addresses, rather than just displayed locally for testing purposes.

Additionally, by entering your Gmail username and password into your Joomla configuration your Google credentials will be stored unencrypted on your server. A Google account can often contain large amounts of personal and sensitive data and if your website is compromised these Google credentials may be obtained by a third party.