Mar 30, 2009

Mail notification for Mutt (and Gmail, Thunderbird, and etc)

I've introduced basic configuration for Mutt in recent posts. But we still have a problem: how do I get notified when I have new mail?

Gmail users might also have similar problem. We certainly don't want to login to Gmail every 2 minutes. Of course gtalk can solve this problem. But what if one has several Gmail accounts, or even have Gmail AND Yahoo accounts? (If you don't use Mutt, you can directly go to the Mail Notification part)

First, we need to let fetchmail to download new mails every, say, 5 minutes. This could be done by setting up a crontab job. Edit the crontab list in your terminal:

crontab -e


Then add the following line.

*/5 * * * * fetchmail -v >/dev/null


"*/5" means fetchmail will run every 5 minutes, and the part after ">" means there won't be any output.

OK, now fetchmail will download your emails automatically.

Mail Notification

The extra software you need to install is Mail-Notification.

sudo apt-get install mail-notification


You can run it from System -> Preference -> Mail Notification. In the Mailbox list, you can add your Mutt's mbox type mailboxes. Remember to check "Auto start Mail Notification upon session opening". Now once there is new mail in your mailboxes, a notification will appear in the status area.



Note that "Mail Notification can monitor multiple mailboxes concurrently, and supports Evolution, Gmail, IMAP, Maildir, mbox, MH, Mozilla products (Mozilla, SeaMonkey, Thunderbird, …), POP3, Sylpheed, Windows Live Hotmail and Yahoo! Mail mailboxes." (Description and screenshot are from http://www.nongnu.org/mailnotify/)

So, if you are a Gmail user, you can also use Mail Notification to check if there's new mail in the server. This is really a handy software.


3 comments:

Anonymous said...

thumbs up !

jvdm said...

Yes, but there is a slight problem: mail-notification will mess up with the mail boxes access time and mutt won't flag them as having new messages, am I right?

Ben Ward said...

I just followed the instructions, and changed the default email using gconf-editor to /usr/bin/mutt, and set cron to do both getmail and this notifier at the same time, and it works very well, it tells me I have a new message and then when I click on it, mutt opens up and (@jvdm) mutt still highlights the email as new.

Welcome to Non-geek's
Linux Handbook!

or if you will, Linux Cookbook.

Read my READY-TO-USE
RECIPE-LIKE
tutorials on Linux applications~

Subscribe if you are willing to follow.

If you find the post useful, please click the donate button on the upper right corner. Any amount is useful.