www.mvcsys.deSmtpAuth

The online version of this file is here.

SMTP Authenticating Proxy

Author: Marcus von Cube <marcus@mvcsys.de>

This is free software, do what you want with it but don't make a commercial product from the sources. The software is provided as is. I'm not reliable for any consequences arising from the usage of it.

This is work in progress! Current versions are 0.81 for SmtpAuth and 0.60 for EpocUtil both from 20 Apr 2005.

What is SmtpAuth?

As a measure against spam many mail providers recently switched to SMTP authentication: their mail delivery systems require a user name and a password to accept mail. (Others, like CompuServe or T-Online, require you to use their own network to connect to the SMTP server.)

Some older email clients like the mail application on Psion handhelds (running EPOC as their operating system) do not support the neccessary SMTP protocol variant. Therfore there is a need to overcome this limitation. SmtpAuth provides a solution based on the idea that it is enough to intercept the traffic between the mail program and the server and add some handshaking during the connection phase.

SmtpAuth is neither a mail client nor a mail server, it is a proxy with only a limited amount of added functionality. And it has nothing to do with retrieving mail, POP3 and IMAP4 are totally different from SMTP discussed here!

How is it used?

Setting up SmtpAuth

You need to tell the proxy the connection details of your mail provider, that is the IP name of the server, its port if not the standard value of 25, your username and your password.

Your mail client now has to be configured to use "localhost" as the SMTP server and a port number that you can freely select (see example below). Different port numbers allow for more than one simultaneous configuration for different servers.

The configuration of SmtpAuth is stored in an ini file. The default name is "SmtpAuth.ini" but that can be changed on the command line. On EPOC systems, the file is in C:\System\Apps\SmtpAuth\SmtpAuth.ini. An example configuration is automatically created:

[Global]
;
; SMTP authentication
;
; Change the following line to interface=all or any other ip address
; if you want SmtpAuth to listen on other ports as well.
; On EPOC this will cause a dialup request!
;
interface=localhost
;
; Set the following line to =on or =yes to enable data tracing for debugging
;
trace=no
trace-file=C:\LOGS\EMAIL\SmtpAuth.trc

;
; You can name your editor here
;
editor=Editor

;
; If you have problems with bounced mail because of an illegal HELO
; you can add a hostname here that will be used in greeting the server
;
;hostname=netBook.wehrheim.mvcsys.de

[Sink]
;
; Dummy listeners on some ports to prevent EPOC lockup.
;
; Setting active=yes causes a dial up request on startup.
; You must use this option, if you run SmtpAuth without GUI!
; The default behaviour is active=no. You can start the
; listeners from the GUI (Tools->Activate Sink, Ctrl+I).
;
;active=no
;ports=80,135,137,445,4444

[Server example]
;
; Define an SMTP server
;
active=yes
listen-port=1025
server=smtp.example.com
port=25
user=your userid
password=your password
;
; Add this, if you want POP before SMTP authentication!
; This setting causes a short dummy visit to the POP server.
; Some ISPs allow access only after the POP server has been
; logged into.
;
;pop-server=pop.example.com
;pop-port=110
;
; You can delete or modify header information.
; Deleting bcc headers is useful for EPOC mail.
;
;header.bcc=-
;header.reply-to="John Doe" <john@doe.org>
;header.x-proxy=SmtpAuth by Marcus von Cube

[Server isp2]
;
; Define a 2nd SMTP server (you can have more)
;
active=no
listen-port=1026
server=smtp.isp2.net
port=25
user=user name 2
password=password 2

[Server transparent]
;
; Define a generic proxy (e. g. to create a trace file for another app)
;
active=no
transparent=yes
listen-port=21
server=ftp.somewhere.com
port=21

As you can see, there is a POP server mentioned in the example: Some providers allow access to their SMTP server only after the POP server has been contacted with a valid user and password. You can do it yourself by opening the mailbox before sending. SmtpAuth just does it for you, now!

Spelling and capitalization is significant. I'll provide a GUI configuration option in a later release. Passwords will be encoded after the first run, marked by the sequence "~=" instead of "=". Remove the "~" if you change passwords!

Menu Structure

File Menu

The File menu contains the following entries:

Tools Menu

The Tools menu contains the following entries:

Sink - Preventing EPOC Lockup on Dial Up Connections

EPOC has a nasty bug which causes a system lockup (100% busy) if an attempt is made to access an inactive TCP port from the outside over a dial up connection to the Internet. This happens as a result of the recent worm attacks.

Activating the section [Sink] can help. It causes the activation of dummy listeners on some ports which are commonly attacked. The default setting defines some ports but the listeners are not active until you use the menu Tools->Activate Sink. This has been done to prevent the program to cause an unwanted dial up request upon startup. Activating Sink will pop up the connection dialog.

Once started, the listeners cannot be deactivated until you restart the application.

Setting up Your Mail Client

The following screenshots were taken on an emulated EPOC system.

Create an account



Set outgoing server to "localhost":



Set port number to 1025:



Use your ISP for incoming mail (not handled by SmtpAuth):

Implementation

Prerequisites

The Program is written in the Java programming language. Since Java runs on a variety of platforms SmtpAuth does so as well. You will need a Java Virtual Machine (JVM) which adheres to the older Java 1.1 specification but a Java 2 JVM will of course do, too.

SmtpAuth runs well on (and is even optimized for) PDAs based on the EPOC operating system. These are the Psion Series 5mx, Revo+, netBook, netPad and the Ericsson MC218. It does not work on the older Series 5. Its version of EPOC does not support the Psion JVM. The 8MB Revo seems to be too constrained on memory.

Starting the Application

SmtpAuth is a Java application which can be used without modification on a number of platforms. To start it from a command line you have to type:

java -cp SmtpAuth.jar de.mvcsys.smtpauth.SmtpAuthGui <inifile>

On a Java 2 system, the following should work as well:

java -jar SmtpAuth.jar <inifile>

<inifile> defaults to SmtpAuth.ini in the current directory. EpocUtil.jar must be installed somewhere in your classpath (see below).

You can save some memory (and lose comfort) if you start the class de.mvcsys.epocutil.SmtpAuth (without "Gui"). Pressing any key terminates the program.

On EPOC, things are easier because everything is installed in the right places by the SIS installer and you'll find a nice icon on the extras bar :). The command line can be found in a file named SmtpAuth.txt in the installation directory. If you use the variant without GUI, it's neccessary to create a dummy file \System\Java\Console on some drive to make the output visible.

What is EpocUtil?

This is a library for Java applications that tries to mimic some of the GUI aspects of the EPOC operating system found on Psion handhelds. It works on other platforms as well and is a neccessary part of SmtpAuth. On EPOC, it is installed in \System\Java\ext\epocutil.jar and \System\libs\EpocUtil.dll. On other systems, only the jar file is used and should be copied to the lib\ext directory in the JRE path of the Java installation (Java 2).

If EpocUtil finds a file named "EpocUtil.properties" in the classpath, it adds the contents to the system properties. This can help in overcoming some localization problems especially on EPOC where a copy is automatically installed in \System\Java\classes. Edit the file at your will. Here is the current German version of the file:

#
# additional system properties
#
debug=0
user.language=de
user.timezone=ECT
user.region=DE
user.home=C:\\Dokumente
epoc.msgapp.title=E-Mail

The last entry allows SmtpAuth to find and start the email application on an EPOC device with a single tap.

Im still searching for valid entries for this file in different locales. Please report back your settings, especially, if you don't live in Germany or the UK!

Download

On EPOC, you'll need two files:

The generic java version comes in one package:

The sources are available for reference: