[OT] Home Email Servers

Matthew Flaschen matthew.flaschen at gatech.edu
Tue Mar 10 22:50:32 UTC 2009


Mark Greenwood wrote:
> I sent this once but I sent it as HTML. Whoops. Anyway...

Sending it three times (HTML+plaintext, then plaintext again) is not
really helping the list's bandwidth.

> Not strictly Kubuntu related this one, but there seem to be plenty of
> clever people on here.

I don't really see this as off-topic.

 Kind of follows on from the kmail discussion
> we were having. Because I have one of these new-fangled laptop things
> ( ;) ) I want to be able to access my email when I'm on the move.
> However, my ISP, in their infinite wisdom, will only let me access
> their mail servers if I am connected to my home cable connection. (I
> can see why they do this though).

I could kinda see why they would block /sending/ mail (only kinda) from
external networks, but not at all why they would block receiving.

> So.. what I want to do is to have a server at home. I should be able
> to connect to this server via ssh from anywhere (I already have
> dynamic DNS and the server, I just need to know what to install on
> it....). This server provides me with IMAP mailbox(es), and collects
> my POP3 mail from my ISP into those mailboxes. It also provides me
> with an SMTP relay server so I can send mail via my ssh connection to
> my ISP. I think the latter can be done somehow with sendmail.. but
> the former..??

I think you can avoid installing anything on your home server and just
use SSH's built-in port forwarding.  On your laptop, you would run
something like:

sudo ssh -L 996:pop.mail.isp.com:995 -L 26:smtp.mail.isp.com:25
username at homeserver

For gmail, for instance, that is:

sudo ssh -L 996:pop.gmail.com:995 -L 26:smtp.gmail.com:25
username at homeserver

The ports before the first colon are specified by you, and can be
whatever you want, as long as they're free.  Note you don't have to run
it as root if  you use local ports above 1024 (e.g. 1025 and 1026
instead of 996 and 26). The ones after the second are the normal SMTP
and POP ports specified by your ISP (these you may have to change from
my example).  All you have to do is leave this ssh session running on
your laptop, then configure your mail program to use localhost 996 for
POP3 and localhost 26 for SMTP (keep the other settings the same).
This method is conceptually simple.  Anything your laptop sends to or
receives from localhost 996 or 26 goes to pop.mail.isp.com 995 and
smtp.mail.isp.com 25 respectively, via your home server.  It's
completely undetectable by your ISP (unless they're timing you, which is
obviously unlikely), and obviously secured between your laptop and server

Now, the advantage to running a actual server as suggested is that then
only one box is talking to your ISP with POP3, so you don't have to
worry about "Leave mail on server" and such (having multiple boxes talk
to a single IMAP account is smoother).  But I doubt it's worth the
complexity.

Matt Flaschen




More information about the kubuntu-users mailing list