• Follow us on Twitter @buckeyeplanet and @bp_recruiting, like us on Facebook! Enjoy a post or article, recommend it to others! BP is only as strong as its community, and we only promote by word of mouth, so share away!
  • Consider registering! Fewer and higher quality ads, no emails you don't want, access to all the forums, download game torrents, private messages, polls, Sportsbook, etc. Even if you just want to lurk, there are a lot of good reasons to register!

Using K9 with a POP server that requires SSL

Clarity

Will Bryant
Staff member
No one else may need this, but because I had to spend time figuring it out, I'll pass what I learned along in case someone else does down the road.

K9 (http://kier.net), the anti-spam program I use, doesn't support 'secure' servers. Gmail is an example of one, but BP's email server is the same way.

The solution is a program called sTunnel. It's available from http://www.stunnel.org/download/binaries.html. As of this writing, the current version (and the one I'm now using) is 4.14. If it's been a while since I posted this, there may well be a newer version. Go with whatever is most recent, it's unlikely the relevant details to what we want to do with it will change much.

Basically, when you use K9, it functions as a proxy. Meaning you tell your email client that your email server is your local machine, port 9999. K9 sees that you're polling it for mail, and in turn it connects to your remote POP server. sTunnel simply adds another stop along the way. Your client connects to K9, which connects to sTunnel, which securely logs-in to your remote SSL-enabled POP server to pull your mail down.

Installation is easy (once you know what you're doing, sadly, figuring all this out took me hours yesterday, blah). Download sTunnel, install, and then go into the new start menu folder, and select 'Edit sTunnel.conf'.

Once that text document comes up, scroll down to line 33, which should be;

Code:
;client  = yes

Just remove the semi-colon before client.

Now, every line that has text below that point that doesn't have a semi-colon, go ahead and add one just to close things off you don't need.

Below line 35, which should be;

Code:
; Service-level configuration

drop down a few lines, and add your remote server info.

For the purposes of my example, we'll say your mail server is 'pop.mail.com', the port is '995' for a secure connection, and that your username is 'user'.

Code:
[pop3s_user[sup]1[/sup]]
accept	 = 127.0.0.1:11010[sup]2[/sup]
connect  = pop.mail.com:995[sup]3[/sup]
delay	 = yes

[sup]1[/sup] - doesn't matter what you put, this is just a note to yourself. I have multiple gmail accounts running through this, so mine has 'account name-gmail' where 'user' is.
[sup]2[/sup] - '11010' is the port I used, you can use just about anything you like as long as it isn't already spoken for. In my case, I have 5 different email accounts on 5 different SSL servers being polled. So each of those accounts has its own entry in the stunnel.conf file -- and each has its own port number. So for the next account, the accept line would have '127.0.0.1:11011' instead of '127.0.0.1:11010'. The next would have '127.0.0.1:11013', and so on.
[sup]3[/sup] - 'pop.mail.com:995' -- this is just your 'server : port' (I added spaces there to prevent the colon and 'p' from turning into an emoticon), where the server can be name or IP (I used the name, in this example). Generally speaking, the port is going to be 995 for 'secure' mail, and 110 for normal POP -- but you don't need sTunnel for the normal POP. Just go straight through K9 for that, instructions can be found on kier.net.

Now hit File, and Save. Then you can close.

Go back to Menu > Programs > sTunnel, and run the 'Service Install' and then 'Service Start'. This should be the last time you have to mess with any of that, as it will now start up when you fire up Windows.

sTunnel is now running, configured, and listening on the ports you've told it to. So now it's time to configure your email program. Go to your account settings.

We need to tell your mail prog to connect to K9, and we need to tell K9 to connect to sTunnel. We've already told sTunnel to connect to your mail server(s).

So take this;

Code:
Server Name: pop.mail.com
Port: 995
User Name: user

And change it to this;

Code:
Server Name: 127.0.0.1
Port: 9999
User Name: 127.0.0.1/11010/user

Basically what we've done there, is point your mail client to your own machine, port 9999. K9 (if you already have it installed) is listening on that port. When your mail client connects, K9 reads your User Name entry, and pulls from that instructions regarding where it should in turn connect. In this case, we're telling it to connect to the port on your local machine (11010 in this case) where sTunnel is listening. When K9 connects to sTunnel, it reads from stunnel.conf, and in turn connects directly to your mail server.

If you have multiple accounts, just remember to use the right sTunnel port (11010, 11011, 11012, etc., at least in my examples) for the right email accounts.

It's all pretty simple once you know how to do it all, but trial-and-error'ing my way through it without documentation was a bit of a mess, so thought I'd record the process. If it helps someone, great, if not, at least I'll have a record in case I ever need to do all this again on a new machine or something.

As an aside, two proxies between you and your email may not be ideal, but in my case, there is no noticeable slowdown, and both K9 and sTunnel have very small memory footprints. Which is to say no real impact on the performance of your machine.
 
Last edited:
Back
Top