Automail for fli4l

ArticleCategory: [Choose a category, translators: do not translate this, see list below for available categories]


AuthorImage:[Here we need a little image from you]

Stefan Blechschmidt

TranslationInfo:[Author + translation history. mailto: or http://homepage]

Original in de Stefan Blechschmidt 

de to en Jürgen Pohl

AboutTheAuthor:[A small biography about the author]

Being a trained electrician, I found myself in 1990 in front of a CAD workstation to develop a switch and control station. Obviously, I got infected by a then unknown 'virus', and that's just fine.

Abstract:[Here you write a little summary]

Who is not using this one diskette router from ? Most likely everyone of its users knows about the problem when the router is being used in dial-on-demand mode in an existing network system with internal mail server. When the router establishes a connection the mail server should know about it, this would enable it to send and receive mail.
This article is describing one possibility on how to solve this problem.

ArticleIllustration:[One image that will end up at the top of the article]

Automail mit fli4l

ArticleBody:[The main part of the article]

Short Description of the Environment

Our illustration shows the concept of the network which we are going to use as a example for this article. WS1 to WS3 represent workstations connected to the WWW through the router. The service-host is responsible for the internal and the external mail. Sending mail is being handled by MTA. Receiving with fetchmail and subsequent sorting with procmail. The mailboxes on the service host are provided to the workstations via POP3 or IMAP

The Problem

If one of the workstations is establishing a connection to the WWW the service host does normally not notice it. It would be possible to instruct the service host with the help of a cron job to send or receive mail at specific times. More elegant would be to inform the service host when the connection is being established, enabling it to do the mail job.

Since the router is being run from a diskette, there is no complex script or program to control the mail server from the router.

The Idea

While informing the service host about the connection, it should be possible to launch a request to start a process for mail to be sent or received.

The Solution

For fli4l a program named wget is available , with the size of about 100 kB, it should fit easily on the diskette. With wget we can establish a connection to the service host at the same time when dialing. This will be possible by inetd opening a port on the service host, waiting for a connection from the router. With the connection a script will start additional processes to send and receive mail.

The script is written in Perl you may download it here (

Router Adjustments

Dialing in activates the file .../opt/etc/ppp/ip-up. This is the right place to establish a connection to our service host. By adding the line:

wget -t 1 --spider MAILSERVER:PORT/xyz &> /dev/null

we are doing just that.

Explanations to the Commands of wget

Mail Server Adjustment

With the help of the super server inetd the program mailstart [1] is being activated. To make this happen we have to edit the files



In this file we assign the port which wget shall access. The line:

mailstart  4000/tcp # Mailstart

does accomplish that.


In this file we are defining which program should be started. inetd monitors its execution and logs this in /var/log/syslog.

The line:

mailstart  stream  tcp  nowait  root  /usr/sbin/tcpd  /root/bin/mailstart

is going to finish this step. The first name must be the same as noted in the file /etc/services.


Through variables the program can be adjusted to the particular server.


With the variable $protokoll we can define if the calls shall be logged. Setting the variable to 1 will log the calls in /var/log/mailstart.log. If the variable is set to 0 no log will be created.

Default: 1 create log


With this variable we can determine the target of the log.

Default: /var/log/mailstart.log


Here we enter the name of the program which fetches the mail. To start that program the user must be root or the name which was entered into /etc/inetd.conf. If someone else wants to use the program the command has to start with su USER -c \"COMMAND PARAMETER\" . If the command is several words long it has to be set in quotation marks, also, it must be protected with \.

Default (one line):
su postmaster -c \"fetchmail -t 40 -a -L /var/log/fetchmail/fetchmail.log -f /home/postmaster/.fetchmailrc\"


Here is the place for the program used to send email. To start that program the user must be root or the name which was entered into /etc/inetd.conf If someone else wants to use the program the command has to start with su USER -c \"BEFEHL PARAMETER\". If the command is several words long it has to be set in quotation marks, the command must be protected with \.

Default: sendmail -q

By the way, part of the program is a small POD documentation which provides a short description. You can get to the description with perdoc mailstart.


Prior to testing the super server needs to be restarted, /etc/init.d/inetd restart should do it. Now you can test with telnet localhost mailstart if the server responds . You should get a display similar to this.

Connected to localhost.
Escape character is '^]'.
HTTP/1.1 220 OK
Date: Sun, 20 Jul 2003 10:45:46 GMT
Server: mailstart/perl (sbsbavaria)
Last-Modified: Sun, 20 Jul 2003 10:45:46 GMT
Content-Type: text/txt
Content-Length: 11
Connection closed by foreign host.

Well, that's it. I hope you are getting the desired result from my description. If that's not the case we do have a problem.
- You, because it doesn't work.
- I, because I was not able to give a decent description:-).


Links / References