Tuesday, October 29, 2013

Cygwin SMTP and POP3/IMAP Mail Setup

The client I'm currently working for is an encrypted email provider. At times development/testing involves a lot of variations on sending and receiving email, and on occasion I also want to be able to see exactly what's being sent/received. We have some development mail servers, and most of our builds are deployed via a Jenkins build to a VMWare farm -- but sometimes it's a bit of a hassle to use these, especially if they aren't configured for what I need or if someone else is busy on the host I need.

So I thought, wouldn't it be nice if I could set up an SMTP mail relay and POP3 server locally, so that I can run tests and experiments.

The result of that thought was about an hour of Google-fu and a few experiments. In brief, what I arrived at was Exim and inetd+uw-ipop3d running in Cygwin. I'd write up the details, but that's already been done. In short, if you want to run your own personal mail server, set up Exim by following the instructions here and set up inetd+uw-ipop3d by following the instructions here.

This will give you a bare-bones setup suitable only for sending and receiving email on your computer. On the SMTP side there's no authentication at all; DO NOT do this on a computer reachable from the Internet. And it's not configured to send emails to the world. On the POP3/IMAP side, when you install uw-ipop3d the user the service runs as will be the only user you can log in with. Or to put that another way, the only person that can receive email through IMAP is that user. I have a cyg_server account which got set up my sshd I think, and am using that. You'll log in using the normal Windows credentials for that account. (Note you can look at /var/spool/mail to see the mail for any other user who you send email to.)


Ensure you have /etc/c-client.cf with the following:

I accept the risk
set disable-plaintext 0