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 - somebody@my-domain.com ?

Fetchmail configuration

Fetchmail by Eric S. Raymond esr@snark.thyrsus.com

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 mail.my-isp.net 25
HELP
QUIT
You are looking for ETRN as a valid command. Sendmail can be found at www.sendmail.org 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 "my-domain.com", and your ISP "my-isp.net" :-

$ nslookup -type=mx my-domain.com
Server: ns.my-isp.net

Non-authoritative answer:
my-domain.com preference = 10, mail exchanger = my-domain.com
my-domain.com preference = 20, mail exchanger = mail.my-isp.net

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 mail.my-isp.net. When your connection comes up, execute the following simple script :-

#! /bin/sh
#
# Send ETRN command to sendmail 8.8.x - Andy Rabagliati <andyr@wizzy.com>
#
telnet mail.my-isp.net smtp <<SMTP_EOF
ETRN my-domain.com
QUIT
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 http://www.swinc.com/resource/exch_dq.htm though those intructions are aimed at MS Exchange users.


Next Batched mail solutions