SMTP Relay Server

  1. Introduction

    The SMTP RelayServer is a SMTP mail server application, implementing the RFC's 821, 882, 883, 973 and 974. This is not a full mail distributing system like sendmail or smail. It works just as a relay server. The server listens to the TCP port 25. If a client connects to it and asks for an email delivery, the server tests via the domain name system, if a mail server for the domain of the required recipient exists. After reading the mail data, the server application will deliver the mail to the destination mail server. If the given account doesn't exist, the server application will try to deliver the mail to the sender with a message and an error code. The SMTP RelayServer does not log any connection or delivery. Also there is no possibilities to configure a restricetd group of users or to deny to certain IP's to use it. The SMTP RelayServer is written with the JDK 1.1.6 and is Open-Source-Software. I wrote it under the terms and conditions of the GNU General Public Licence.

  2. Installation

    The following instructions are for a computer running Linux or a similar UNIX-like operating system. For a Windows computer, you can use the same commands on the DOS prompt just by turning the slashes into backslashes. To uncompress and extract the sources, use WinZip.
    First of all, you must have installed at least the Java Development Kit 1.1.6 on your machine. For further information visit the homepage of javasoft. After java works fine on your machine and your $CLASSPATH variable points to, you can download the source files of the relay server (10.5 kB). Put it in a directory where you want to install the relay server. Unpack it with:

    tar xvfz smtp_relay_server_src.tar.gz

    Now you have to compile and archive the files. You go into the new created directory named smtp_relay_server and execute the following two commands:

    javac -O -d . *.java
    jar -cvf smtp_relayserver.jar smtp_relayserver/

    Open now the smtp_relayserver.conf file and change the entries as following:

    NameServer1: [type here a name server who is near from you, like the providers first one]
    NameServer2: [type here a name server who is near from you, like the providers second one]
    Administrator: [type here the e-mail address of the computer owner]

    You can determine the name servers with nslookup or by asking your provider.
    After you have done all the steps above, you can start the relay server. To do that, you need the rights to create sockets on the TCP port 25 and on the UDP port 53. Ask your administrator or execute it as root, if you don't have these rights. To execute it with the java virtual machine, type:

    java -classpath $CLASSPATH:smtp_relayserver.jar smtp_relayserver.SMTPRelayServer

    where $CLASSPATH points to the java libray archive
    In this case, the config file smtp_relayserver.conf must be in the current directory. If you want it in another one, /etc for example, just type:

    java -classpath $CALSSPATH:smtp_relayserver.jar smtp_relayserver.SMTPRelayServer /etc/smtp_relayserver.conf

  3. Remarks

    The SMTP Relaserver was not designed to be a real mail delivery system. It leaks a lot of security features to avoid to be used by spammers. Please don't use this application on a server that is directly connected to the Internet.
    The source files are javadoc compliant. You can create your own documentation of the classes and methods by using javadoc. How to do that, please refer to the javadoc manuals from the JDK. Here you can see an already created documentation of all the classes.

Valentin Koch
Last modified: Tue May 14 16:14:44 CEST 2002