Windows»Email installation for Windows»stunnel used with Blat email
  • RSS Feed

Last modified on 4/5/2017 5:25 PM by User.

Tags:

stunnel used with Blat email

If the customer does not have their own email server you can use gmail as the server.  However,  gmail requires a security protocol SSL that Blat does not support.  There is a free open source program named stunnel that can add the SSL protocol to Blat.  As of 05/17/2015 we use stunnel version 5.17.   Avoid stunnel version 5.14 (it fails).

A copy of version 5.17  is on OneDrive \SoftwareTools\stunnel\5.17 (as of 4/5/2017).

Stunnel will establish a local IP address and port for itself so you can point Blat to it.  Stunnel will encrypt/decrypt the messages to/from gmail using the SSL protocol.  This is all transparent to Blat.  So far, this has worked well with gmail, bluehost, and godayddy.

stunnel is open source software.  It's home page is www.stunnel.org.

1. Create new directory on the customer's server c:\Program files\stunnel.  If this is a 64-bit Windows server then the directory will be c:\Program files(x86)\stunnel.

2. Download the contents of  OneDrive \SoftwareTools\stunnel\5.17 directory to the customer's stunnel directory. 

3. Install stunnel by double clicking the stunnel-5.17-installer.exe file.  If you want to install a newer version you can download it from http://www.stunnel.org/download/binaries.html

  • Leave the two installation checkboxes checked (install stunnel, and add start menu shortcuts) 
  • You must let it install into the default directory C:\Program files\stunnel  [or Program files(x86)\stunnel]

4. Copy the stunnel-5.17-samples.conf to overwrite stunnel.conf.   Edit the stunnel.conf file so only the connection clients you need are active. The samples include connections for bluehost.com,  gmail.com,  godaddy.net and office365.com.

As of version 5.17 it isn't wise to allow stunnel to do any logging.  It seems to interpret the "debug=7" parameter backwards and logs everything EXCEPT errors. 

5. Install stunnel as a Windows service.

  • Start --> all programs --> stunnel --> service install

6. Start the stunnel service for the first time.  The "service install" task doesn't start the service.

  • Start --> all programs --> stunnel --> Run stunnel

7. Copy the following files from mvs:MVS_ROOT\win32\bin to the same directory on the customer's server.

blat.exe
blat_install.bat
blat_opt.txt
blat_opt_dbg.txt     (used to replace blat_opt.txt only when debugging)
blat_readme.txt
mvmail_bdy.txt
mvmail_trl.txt

8. Edit the 3 blat files in the stunnel directory.  They are already configured to work with stunnel but you still need to edit them so they will work for the customer.  DO NOT RUN THE BLAT_INSTALL.BAT ON THE HOSTED SERVER OR ANY SERVER THAT WILL USE MORE THAN ONE EMAIL SERVER OR CLIENT.

blat_install.txt looks like this: blat -install -server 127.0.0.1 -port 25 -f nmiller@gmail.com

  • Change the email address to the customer's email address for SMTP authentication.
  • If the email client is running on the same machine as stunnel then leave the server as local 127.00.0.1 but if the email client is on a different machine then you need to change the server to stunnel's lan IP address (example 192.168.0.15) .  Port 25 is the normal default port you could make it anything else if you need to avoid conflicts with another email client that is already using port 25. This is stunnel's address and port (not the SMTP server's address).

blat_opt.txt looks like this: -server 127.0.0.1 -port 25 -u nmiller@gmail.com -pw nmiller1 -try 2 -q -debug -log F:\u\mvs\dsk0\100001\trash\blatlog.txt

  • Normally leave the server IP address as local 127.0.0.1 and port as 25.  But if the email client is installed on a different machine than stunnel (like a Unix server) then use the lan IP address of the stunnel machine (example 192.168.0.15)   This is stunnel's address.
  • change the -u (email address) and -pw (password) to the customer's gmail address for SMTP authentication.
  • change (if necessary) the Drive letter on the -log blatlog.txt path  F:\u\mvs\dsk0\100001\trash\blatlog.txt

blat_opt_dbg.txt is identical to the blat_opt.txt file and needs to be edited the same way too.  It is a backup file.

9.  Copy the 3 blat files you just edited from the stunnel folder to the %MVS_ROOT%\win32\bin folder.  Overwrite the existing files.

10. Install blat by going to the  %MVS_ROOT%\win32\bin  folder and double clicking on the blat_install.bat.  It should show you it was successful.

11.  Installation is complete.  Test by sending yourself a report from Profits Plus.