Mail and Dynamic IP

It's possible to run a mail server on a dynamic IP address, (as Frank Crawford reported doing in ‘My Home Network’ several auugn's ago) but it's usually a bad idea. The problem is that if your IP address changes while someone's sending you email (for example, your aDSL connection drops, and while it's down someone else grabs your address) the email is delivered to the machine that your old address was allocated to --- and bounces.

In addition, my current ISP blocks port access to the SMTP port, so there's no point in running a mailer daemon directly accessible from the internet.

Living with the problem

The simplest thing to do is just to live with the problem. Advertise the email address you got from your ISP, and use IMAP or whatever to read your email.

However, this defeats the purpose of having your own domain, and means that when you change your ISP, or your ISP changes the addresses on you, you have to tell everyone the new domain name.

Third Party Hosting Services

There are any number of third party email hosting services --- Hotmail, Yahoo! Mail, etc., etc. Most will not host your entire domain's email for free, although some are fairly cheap.

The one I've found to be best is fastmail.fm an Australian company whose entire business is handling outsourced email. They'll do low volume mail handling for free; and for slightly more will host your entire email requirements.

Redirecting Email to a different Port

There are companies that offer (at a price!) the ability to redirect port 25 on their server to a different port on yours. For example, no-ip.com or Mailkeep will do this.

According to their web page, Mailkeep also ensures that when your IP address changes, your email is still delivered correctly, and not to the site that obtained your old email address. (It parses the string sent by your MTA on initial connection, and refuses to deliver if it's not the one it expects).

Alternatively you can hire a virtual server from someone like JuicyVPS (or any of the many fine low-cost virtual private service providers), configure your MX records to point to it; configure an MTA there to do spam filtering, etc., then get it to forward to the RFC2476 `submission' port on your at-home server. Setting all this up is beyond the scope of this document.

Using MailForward and ZoneEdit

If your email requirements are small (less than 200M per year, only a few addresses), and you host your DNS with zoneedit.com, then you can set up a poor-man's MTA as follows: The fetchmail configuration file then looks like this (assuming two users, and use of fastmail.fm):
      poll fastmail.fm with proto IMAP and options no dns interval 4
          localdomains YourDomain.id.au
       user 'abc123' there with password 'PASS WORD' is 'user1' here 
          options no rewrite fetchall
       user 'xyz890' there with password 'PASSWORD' is 'user2' here
          options no rewrite fetchall
    

You could of course configure fetchmail in multidrop mode, and deliver all email for your domain to one email account (the one provided by your ISP, perhaps). And it's a good idea to do this as a catchall.

      pop-server.vic.bigpond.net.au aka mail.dnsvr.com with proto POP3
      and options  
        no dns
        envelope 3 "Received"
        localdomains YourDomain.id.au
        user 'pchubb' there with password 'PassWord' 
		to pchubb@bigpond.net.au=peterc * here
	options  pass8bits stripcr no rewrite
      

The problem with this is that in forwarding the email, the envelope address is lost. The only clue as to the destination of the message is then in the To: and CC: headers, and in the trail of Received: headers. There's no guarantee that anything useful will be available from that lot; in particular, if more than one local user subscribes to a mailing list, then it'll be delivered to at most one local user (the headers will be the same in both cases, and there's no clue that two different users should receive the email).

Using ODMR

If you can find/beg/buy a mailhosting service that does ODMR (e.g., mailhost.com.au or mailkeep.com) then you can handle all your own email almost as if port 25 were not blocked.

ODMR (On-Demand Mail Relay, RFC 2645) is a protocol designed for dial-up and dynamic-IP hosts. A host with a static IP acts as your mail relay, collecting email on your behalf. At regular intervals, your system polls the host, and if there is any email for you, turns the connection around and allows the remote host to talk SMTP using the same TCP connexion. A challenge-response password system is used for authentication. Thus there is no requirement to have access to port 25 on a static IP address on your system.

Just set up MX records in your DNS to point to the ODMR host, and then use fetchmail to pull all the email down every 15 minutes or so and pipe it into your local MTA.

The main advantage of ODMR is that the envelope addresses aren't lost, so as new accounts and aliases are created locally, one doesn't have to set up new MailForwards and IMAP accounts elsewhere.

The main disadvantage is that spam filtering is a little harder; you can't set up a tarpit or bounce detected spam straight away, because all email is relayed via your mail host.

My home domains used to use mailhost.com.au and ODMR for mail, and ZoneEdit.com for DNS.

Mailhost.com.au has now closed down, so I'm using a virtual private server. This also allows me to do at-source tarpitting and spam filtering .... but that's for another article.


Last modified: Thu Oct 30 20:01:33 EST 2003