Collect mail from various accounts, filter and store locally
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Collect mail from various accounts, filter and store locally


Beacuse you have several imap mail accounts and would like to retreive mail to local folders so you can read and handle email faster and more convenient.


mailfetch is a system for retreiving mail from different remote imap accounts, filtering the mail according to the rules you set up and storing the mail into local imap folders.


Simply put the file "mail_fetch.rb" into a folder in your defined PATH. Rename the file "mail.conf" to ".mail.conf" and "" to "". Put the files into your home directory. Edit the file ".mail.conf" to include the path to the files ".mail" and ".mail2" as well as to the possibly created file "dead.letter". Add your remote servers with imap url and username - but do not put your passwords into ".mail.conf". The passwords are instead entered into the file named ",". Ensure this file is seen only by you (do "chmod 700").

Add filter rules to each remote server so that mail_fetch.rb knows where to deliver the retreived mail. Just follow the examples in the files, and you'll be fine.

You need to have Ruby installed to run mail_fetch.rb.

My "conkyrc" is included as an example of how you can get visual notice of the mail_fetch running, network being unreachable, inability to login to local imap or remote servers and new mail count for the mail folders you decide to keep a tab on.

I have included the various scripts I use in my conky bar such as getting the CPU temperature, essid of the wifi connection, battery time left, weather information and volume controls.


Add an entry as a cron job using "crontab -e" that lookes like this:

          • /home/yourusername/bin/mail_fetch.rb >/dev/null 2>&1


Copyright 2017, Geir Isene. Released under the GPL v. 3, Version 1.1 (2012-09-30),