To run Exim, you must first decide whether you want it to handle incoming SMTP messages by running as a separate daemon, or whether to have inetd manage the SMTP port and invoke Exim only whenever an SMTP connection is requested from a client. Usually, you will prefer daemon operation on the mail server because it loads the machine far less than spawning Exim over and over again for each connection. As the mail server also delivers most incoming mail directly to the users, you should choose inetd operation on most other hosts.
Whatever mode of operation you choose for each individual host, you have to make sure you have the following entry in your /etc/services file:
smtp 25/tcp # Simple Mail Transfer Protocol
This defines the TCP port number that is used for SMTP conversations. Port number 25 is the standard defined by the “Assigned Numbers” RFC (RFC-1700).
When run in daemon mode, Exim puts itself in the background and waits for connections on the SMTP port. When a connection occurs, it forks, and the child process conducts an SMTP conversation with the peer process on the calling host. The Exim daemon is usually started by invoking it from the rc script at boot time using the following command:
/usr/sbin/exim -bd -q15m
The –bd flag turns on daemon mode, and –q15m makes it process whatever messages have accumulated in the message queue every 15 minutes.
If you want to use inetd instead, your /etc/inetd.conf file should contain a line like this:
smtp stream tcp nowait root /usr/sbin/exim in.exim -bs
Remember you have to make inetd re-read inetd.conf by sending it an HUP signal after making any changes.
Daemon and inetd modes are mutually exclusive. If you run Exim in daemon mode, you should make sure to comment out any line in inetd.conf for the smtp service. Equivalently, when having inetd manage Exim, make sure that no rc script starts the Exim daemon.
You can check that Exim is correctly set up for receiving incoming SMTP messages by telnetting to the SMTP port on your machine. This is what a successful connect to the SMTP server looks like:
$ telnet localhost smtp Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 richard.vbrew.com ESMTP Exim 3.13 #1 Sun, 30 Jan 2000 16:23:55 +0600 quit 221 richard.brew.com closing connection Connection closed by foreign host.
If this test doesn't produce the SMTP banner (the line starting with the 220 code), check that you are either running an Exim daemon process or have inetd correctly configured. If that doesn't reveal the problem, look in the Exim log files (described next) in case there is an error in Exim's configuration file.
Use kill HUP pid, for which pid is the process ID of the inetd process retrieved from a ps listing.