You are not logged in.

#1 2012-08-02 01:57:49

scottro
Member
From: NYC
Registered: 2002-10-11
Posts: 452
Website

Share how you watch multiple mailboxes (for example, with mutt in X)

Note:  I've revised the title of the thread to better reflect what it became.   
For better phrasing of my question, and how I felt it was answered, see post 7.

Again MOST sincere thanks to all who have answered.



For years, I've been using gbuffy. At work, we're primarily RH based, and so far, I've managed to get it working with each new version of Fedora.  I believe Ubuntu still has a version of xbuffy.  (Arch has an unmaintained xbuffy in AUR--I created it in 2006, but abandoned it afterwards. I remember when they pruning AUR, and I think I emailed someone to tell them it was abandoned.)

At any rate, I know that many people here use mutt, and I assume that some work in a similar manner to me, that is, working in X, not having mutt open all the time, but wanting to see if they've gotten any mail.  I've been googling around, found some dock apps, most of which seem to be out of date.   So, what I'm looking for is a multiple mailbox watcher, similar to gbuffy.   Though the FreeBSD port is still available, gbuffy's creator abandoned it years ago, xbuffy is also abandoned. There was also an ebuffy, but that one also didn't build for me.

What do other mutt users use to watch multiple mailboxes in X.  (Watching a single mailbox is easy with the still present xbiff)

Thanks for any answers.   I've gotten lazier and busier as I age, so simpler solutions are better.  I figure people have to be using something, but my googling is getting me nowhere.   (Using terms like mailwatch mutt multiple mailbox watcher, and the like.)

Last edited by scottro (2012-08-03 11:51:29)

Offline

#2 2012-08-02 02:19:45

jasonwryan
Forum & Wiki Admin
From: .nz
Registered: 2009-05-09
Posts: 18,840
Website

Re: Share how you watch multiple mailboxes (for example, with mutt in X)

I use a function in my statusbar script:

eml(){
	maildirs="$HOME/Mail/*/INBOX/new/"
	ml="$(find $maildirs -type f | wc -l)"
	if [ $ml == 0 ]; then
		echo "0"
	else
		echo -en "\x03$ml\x01"
	fi
}

Combined with an urgency hint, it works a treat...


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

#3 2012-08-02 02:37:40

scottro
Member
From: NYC
Registered: 2002-10-11
Posts: 452
Website

Re: Share how you watch multiple mailboxes (for example, with mutt in X)

Ah, that looks interesting.  I actually use mbox most of the time, but I might be able to modify that for it.  I may play with that this week.  Thank you. I'm not sure what you mean by urgency hint--should add that I'm not a programmer, just do some rudimentary bash scripting.

(I should also add that I see Arch has gnubiff which is supposed to handle multiple mailboxes, but playing with it, I didn't like it very much).    (Ah, a quick google gives me an idea of what you mean by urgency hint.)
Lastly, I'll say (and this goes for any who respond) that whether or not it works for me, thank you for taking the time to answer.

Offline

#4 2012-08-02 03:08:19

jasonwryan
Forum & Wiki Admin
From: .nz
Registered: 2009-05-09
Posts: 18,840
Website

Re: Share how you watch multiple mailboxes (for example, with mutt in X)

It may not be relevant to your needs, but I wrote up my approach to this here.

There was some research into the performance benefits of maildirs over mbox; mutt seems equally happy with either. If you have a large amount of mail, I'd also recommend mairix or notmuch for indexing: the difference is pretty phenomenal.


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

#5 2012-08-02 03:20:42

scottro
Member
From: NYC
Registered: 2002-10-11
Posts: 452
Website

Re: Share how you watch multiple mailboxes (for example, with mutt in X)

I don't keep a lot of mail.  Maildir has the obvious advantage that each email is a separate file, whereas with mbox, you can lose your entire mbox.

The reason, IIRC, I wound up choosing mbox was because it was easier, at the time, to get an idea of how much mail I had--after that, it's just become habit.    (Haven't used maildir in awhile, but at the time, at least, it would show all directories as being 4k, regardless of what was in them.)

I definitely don't keep enough mail around to require an indexing program--just using the simple mutt tools has always been adequate for my  relatively simple needs.  (They look interesting though)

Offline

#6 2012-08-02 08:47:51

skanky
Member
From: WAIS
Registered: 2009-10-23
Posts: 1,838

Re: Share how you watch multiple mailboxes (for example, with mutt in X)

From what you say, this is probably way to complicated for your needs, but I'll mention it anyway as you there are ways to simplify it I think.

I use getmail to download my mail, pass it through procmail, and in procmail I call notify-send (as well as filter, etc.).
You can use many things to display a notify-send, but currently I use dunst (see contributions forum).


"...one cannot be angry when one looks at a penguin."  - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle

Offline

#7 2012-08-02 12:44:41

scottro
Member
From: NYC
Registered: 2002-10-11
Posts: 452
Website

Re: Share how you watch multiple mailboxes (for example, with mutt in X)

Ok, I'll look at that--I also use getmail, but then use maildrop.  (I used to use procmail, but Charles Cazabon wrote a few posts on the getmail list that got me interested in trying maildrop, and I like it.)

I realize, from both answers, that this is my poor phrasing of my question, but you've both also sort of answered it.  My proper question should have been, I use xbuffy or gbuffy to watch multiple mailboxes with mutt.  Neither one is maintained any longer, though Debian and BSD developers maintain a working version.  Does anyone know of another binary program that does the same thing?   If not, why don't people use this anymore?

The answer to the second part is shown by both your answers.   It's, Because, aside from me, <sigh> most folks using mutt with multiple mailboxes are pretty knowledgeable and like to  tinker with various scripts to allow them to do this.  As for you (meaning me---this is someone answering my actual question), as Debian continues to maintain xbuffy, and using alien to make it an rpm still works, you're probably alright for awhile.

I'm not going to mark the thread solved, however, as I do want to hear what other people are doing--even if it's beyond me (or beyond the effort I'm willing to expend), it's really interesting to me, and stuff I will probably play with if I ever get some spare time. 

I'm going to look into this stuff--for example, I'd never heard of notify-send till just now. 

Once again, I'm going to thank the folks who are taking the time to answer this.  Sigh, I guess I am more behind the times than I though.

Offline

#8 2012-08-02 13:20:08

Pank
Member
From: IT
Registered: 2009-06-13
Posts: 370

Re: Share how you watch multiple mailboxes (for example, with mutt in X)

In Conky there's a unseen_mails function.

I use the following script for watching my maildirs and sending off a notify-send, but it depends on my offlineimap.  I'm afraid I don't know whether I wrote the code or someone else did.  Possibly it's a mix.

It could probably easily be used with mbox as Python Mailbox supports mbox by default:

#!/usr/bin/env python2
# -*- coding: utf-8; mode: python -*-

import pyinotify
import subprocess
import re

from os.path import expanduser
from mailbox import MaildirMessage
from email.header import decode_header


# Getting the path of all the boxes
fd =  open(expanduser("~/.offlineimaprc"), 'r')
f = fd.read()
maildirs = re.findall(r'localfolders = (.+)', f)
fd.close()

icon = expanduser("~/bin/lib/mail.png")

dec_header = lambda h : ' '.join(unicode(s, e if bool(e) else 'ascii') for s, e in decode_header(h))

def newMail(event):
    print('event happened!')
    f = open(event.pathname, 'r')
    print('Examine %s') % event.pathname
    Mail = MaildirMessage(message=f)

    From = dec_header(Mail['From'])
    From = From.split('<')[0]

    Subject = "'" + dec_header(Mail['Subject']) + "'"
    annoying_spaces = re.compile(r'[\t\n\r\f\v]')
    Subject = annoying_spaces.sub('', Subject)

    f.close()

    s1 = 'New mail from %s' % From
    print('Notifying ...')
    subprocess.Popen(['notify-send', '-i', icon, s1, Subject])


# Instanciate a new WatchManager (will be used to store watches).
wm = pyinotify.WatchManager()
# Associate this WatchManager with a Notifier (will be used to report and
# process events).
notifier = pyinotify.Notifier(wm, newMail)

for dir in maildirs:
     wm.add_watch(expanduser(dir+"/inbox/new/"), pyinotify.IN_CREATE  | pyinotify.IN_MOVED_TO)
     print('watching %s' %dir)


notifier.loop()

Arch x64 on Thinkpad X200s/W530

Offline

#9 2012-08-03 01:52:13

scottro
Member
From: NYC
Registered: 2002-10-11
Posts: 452
Website

Re: Share how you watch multiple mailboxes (for example, with mutt in X)

Heh, looking at all these suggestions, I can only repeat what I said in my earlier post--I suspect the reason no one else ever bothered with an Xbuffy or Gbuffy equivalent is that most of the folks who work like that know enough to set something up the way the respondents to this post have.

Offline

#10 2012-08-03 02:11:57

Wibjarm
Member
Registered: 2012-05-04
Posts: 40

Re: Share how you watch multiple mailboxes (for example, with mutt in X)

This one was originally posted by someone else on these boards (unfortunately, I don't remember who or in what section), although I've fiddled with it a bit.  It's always worked wonderfully for me with multiple maildirs.

#!/bin/sh
while true; do
  notify-send "New Mail" "$(inotifywait -e create -e moved_to ~/.mail/*/INBOX/new 2> /dev/null  | cut -f 1 -d " " | cut -d "/" -f 5)"
done

Just need to change the inotifywait path to wherever you keep your mail folder and run it in the background.

Offline

#11 2012-08-03 03:57:45

scottro
Member
From: NYC
Registered: 2002-10-11
Posts: 452
Website

Re: Share how you watch multiple mailboxes (for example, with mutt in X)

Playing a little with the notify-send, I see how that could work if I needed something at present.   I would have to play with it to get it working though.

(That's not necessarily a bad thing).

Offline

Board footer

Powered by FluxBB