Search This Blog

Monday, 23 February 2009

GMail as your SMTP server

WatchDirectory v4.7

The work-around described in this post will soon be obsolete. The new beta for WatchDirectory v4.7 implements secure SMTP connections, see this blogpost

GMail requires secure connections

If you want to configure WatchDirectory to use GMail as its SMTP server, you will find that currently WatchDirectory does not support secure (TLS/STARTTLS) connections for email. To work around this, you will need to run another program (stunnel) to "wrap" WatchDirectory's connection to GMail. WatchDirectory will then connect to stunnel, which will connect to gmail.

Download / Configure stunnel

Download stunnel-4.xx-installer.exe (I tested with version 4.26) and run the installer. Install stunnel to the directory C:\Stunnel.

Inside the c:\Stunnel directory create a text file called gmailsmtp.txt with the following content (8 lines).

; SMTP configuration for Gmail
output = SMTPgmail.log
taskbar = no
cert = stunnel.pem
client = yes
[ssmtp]
accept = 10.0.0.1:8025
connect = smtp.gmail.com:465

Change 10.0.0.1 to your computer's IP address or name. Do not use "localhost" or 127.0.0.1 as that won't work.

Open a command prompt (cmd.exe) and navigate to the stunnel install directory (CD C:\Stunnel). Enter the following 2 commands to run stunnel as a Windows Service:

stunnel -install gmailsmtp.txt
net start stunnel

Configure WatchDirectory

Now you need to configure WatchDirectory's Email Settings to connect to stunnel.

  • Your SMTP server: enter the same name or IP address you entered in gmailsmpt.txt
  • Port: 8025
  • Authentication: Login
  • Userid: your gmail address (john@gmail.com)
  • Password: your gmail password

Now press the "Test" button. If you configured everything correctly, a test email will be sent. This test email will also show up inside your gmail account in the "Sent Mail" folder.

Further Reading

Configure GMail
WatchDirectory's SMTP Settings

No comments: