Archive for September, 2009

A Mini Fetchmail Howto

Sunday, September 6th, 2009

Since when i was searching on how to use fetchmail, my specific use was a little hard to find. All i wanted was somthing to collect mail from an external pop3 server then re-deliver it to my internal MS Exchange server – the only reason for this is so that i get the ‘new mail’ notification from Outlook instead of mail just appearing in my inbox as when i used another instance of Outlook to collect my mail.

In the end it’s quite easy, simply create a new file in /root/.fetchmailrc to store the data, chmod to 600 and here’s my (obviously edited) config:

set daemon        120 # sets fetchmail to run in background mode checking every 120 seconds

poll pop3.isp.co.uk proto pop3 user ‘user@isp.co.uk’ with password ‘mypassword’ to user@localserver.org.uk smtphost 192.168.7.30

# this line uses the pop3 protocol, checks my isp’s mail server with the correct credentials then forwards to the specified address at the internal IP of my mailserver

poll mail.mywebhost.co.uk  proto pop3 user ‘mywebhostuser’ with password ‘webhostpassword’ to user@localserver.org.uk smtphost 192.168.7.30 ssl

# this line is similar to the first and is for my hosted email service which comes from my webhost provider (TSOHost) and so requires ssl connectivity.

That’s all there is to it really, all i did then is run fetchmail from the command line with no arguments and away it goes. I need to add a start up script to trigger it but apart from that it’s all good. Somthing i want to look at for work is collecting all mail from a mailbox then using the ‘to’ address in each email to forward to different mailboxes.