Mailtraq - the Complete Email Server

Enstar for Mailtraq email server sales & support
Making world-class Internet technology affordable  

Search for:

Advanced search

KB05061301 SMTP Auth - working with Stunnel

See also Using GMail as your SMTP smarthost via TLS

A Mailtraq User has provided this example of fronting Mailtraq with Stunnel to provide TLS.

The example uses 'gmail', but the method would be appropriate for other mail providers.

1. Turn on POP3 collection in your gmail account.
This also enables SMTP sending.
Details at

2. Download and install Stunnel and openssl
This uses stunnel 4.05 and openssl 0.9.7e, both of which were downloaded from 
Create a folder and put stunnel.exe and the openssl binaries in it.

3. Configure stunnel for your mail provider.
Create a stunnel.conf in the directory created for stunnel with an entry for both pop3 and smtp services.

For gmail the entries are:

client = yes
output = stunnel-log.txt
debug = 0
taskbar = yes


[SMTP Gmail ]
accept =
connect =

[POP3 Gmail ]
accept =
connect =

The accept strings contain the ip address and port that you want stunnel to listen for connections on.

4. Arrange for stunnel to start as a service.
It is installed as a service by runnning
stunnel-4.05 -install
from a command prompt in the stunnel installation directory.
If you are using the Windows XP SP2 firewall you need to make the stunnel executable a firewall exception to allow it to open the ports using the control panel security center.
Use the Services window in Control Panel to start it after installation for the first time.

5. Set up the Mailtraq entries in the Mailtraq console.

For POP3 collection this is straightforward. For gmail use the POP3 port (localhost:108) you
created above, your full gmail address ( and password.
It's sensible for gmail to take the leave mail on server option.

For SMTP delivery it's a little more complicated. You need to set up a destination in
the mail routing table using the smtp port (localhost:1099) created above.
Mailtraq, however, picks up the authentication details from an entry for
localhost without the port name.
Create this in Outbox Properties/Remote Mail Server Security.
Setup an account for the plain hostname (localhost) with Server Requires Authentication and the full gmail address and password as for POP3.

6. If you need to set up additional services create more SMTP and POP3
channels in stunnel with unique name and ports. Create additional mailtraq
POP3 collections using the smtp port and account details. For SMTP you need
to create a different name for the host running stunnel. Add extra names to
you host file pointing to or similarly modify your DNS. Use this
name for the delivery destination (with the port number), and for the
authentication details (without the port number).

Information provided by: Peter Sumner, May 2005

Keywords: kb smtp
Mailtraq Highlights...
 SMTP Server     Mailtraq SMTP email server video IMAP Server     Mailtraq IMAP email Server video
 POP3 Server     Mailtraq POP3 email server video Proxy Server     Mailtraq proxy email server video
 Webmail Server     Mailtraq webmail email server video Mailing-list Server     Mailing list email server video
 Groupware Services     Mailtraq groupware email services video Spam and Virus control     Spam and virus control email server video


   Copyright © 2003 - 2011 Enstar Ltd, Enstar LLC & Fastraq Ltd. All rights reserved. Privacy policy.
   Mailtraq® is a registered trademark of Fastraq Limited.