My work email has migrated to M$ Exchange Server, with M$ Outlook Web Access. Eurgh. No more POP3 retrieval to my GMail account.
I restored sanity using an Ubuntu server as follows. Needless to say, this requires that (a) the exchange server allows IMAP access and (b) the SMTP server for your machine will relay mail outside of your domain.
Updated: to do it all via procmailrc, without .forward
Updated: to poll folders other than Inbox
- Install fetchmail and edit /etc/fetchmailrc:
- Make /etc/fetchmailrc look something like this:
sudo apt-get install fetchmail
sudo nano -w /etc/fetchmailrc
set daemon 300
poll your.exchange.server protocol imap username “user” password “pass” smtpname “email@example.com” ssl
replacing your.exchange.server, user (exchange), pass (exchange) and firstname.lastname@example.org (your GMail) as appropriate.
To poll folders other than “Inbox”, you can append the “poll” line in fetchmailrc with the term “folder” and a comma-separated list of names, e.g.:
poll your.exchange.server protocol imap username “user” password “pass” smtpname “email@example.com” ssl folder “Junk E-mail”,”Inbox”
Just in case a real mail slipped into your Exchange junk.
sudo chmod 600 /etc/fetchmailrc
sudo /etc/init.d/fetchmail start
and “tail -f /var/log/mail.log” to make sure that all is OK. You can also try “fetchmail -v” first and look for output similar to that given by this handy guide.