Custom mail delivery solutions

Contents: How mail is delivered
First, a recap of the basics. How does mail from far away get to your account - say - ?

Fetchmail configuration

Fetchmail by Eric S. Raymond

Best to read the fetchmail docs. Fetchmail by default delivers the mail to a local SMTP server. Be careful to tell that local SMTP server to treat your domain as local, otherwise it may punt the mail to your local ISP as a smarthost (as you should be doing with all your other mail) and you will have a mail loop.

For a single user Linux box, I prefer to configure fetchmail with the '--mda' (mail delivery agent) option, pointed to procmail, so I can leave my SMTP server (if I run one - why bother ?) in a basic smarthost configuration.

Administrative access to SMTP server

Fixed IP solutions

Do you have a fixed IP address ? If you do not, it is worth a little time to see if you can get one. My ISP gave me a fixed IP address even though I dial up to their general modem pool - Great !! I think that is a feature of their Portmasters.

A private line will usually get you a fixed IP address.

If you can get a fixed IP address on dialup, you could list them as a Mail Exchanger, but not the lowest, and yourself as the lowest. The Sendmail ETRN command will tickle the remote SMTP server to deliver your mail after dialing up.

Sendmail ETRN command

You need a recent version of sendmail at your server (ISP). Less than 8.8.x will not work. A simple way to find out if your server has the requisite software is to :-

telnet 25
You are looking for ETRN as a valid command. Sendmail can be found at along with all sorts of other useful sendmail stuff.

You now need to set up your MX records for proper delivery of mail. It will eventually look something like this. For your domain "", and your ISP "" :-

$ nslookup -type=mx

Non-authoritative answer: preference = 10, mail exchanger = preference = 20, mail exchanger =

This means that if you are online, mail for your domain will be delivered directly to your machine. If you are offline, it will be spooled at When your connection comes up, execute the following simple script :-

#! /bin/sh
# Send ETRN command to sendmail 8.8.x - Andy Rabagliati <>
telnet smtp <<SMTP_EOF
# End of Shell script

And Bob's your uncle, as we say. I used to have a perl / finger script that would do this, but it was perl4, and past its time ..

There is a good description of other alternatives at though those intructions are aimed at MS Exchange users.

Next Batched mail solutions