[comp.emacs] An rmail question.

ljz%fxgrp.fx.com@ames.arc.nasa.gov (Lloyd Zusman) (10/21/88)

I am using GNU Emacs 18.52 and I have a question about rmail.

I know how to put a line in my ~/.forward file so that sendmail pipes
my mail through a function instead of cramming it into my mailbox.
This allows me to filter my mail messages any way I wish.

However, due to the heavy load on my system and the large volume of
mail I get, the process overhead of this extra filtering is
undesirably expensive.

So, I would like to filter my mail in a different manner.  Since I use
rmail inside of GNU Emacs, it seems to me that it would be nice if the
'rmail-get-new-mail' function could optionally filter the messages as
it takes them from my system mailbox and writes them into my RMAIL
mailbox.  Some sort of hook could be used for this, I presume.

As far as I can tell, there is no existing way of doing this.  Is that true,
or is there some feature of rmail that I have missed which will do this
for me?

If there isn't such a feature, I guess a rewrite of 'rmail-get-new-mail'
is in order.  Before I re-invent the wheel, has anyone out there created
something that will do this kind of mail filtering?  What about mail systems
other than rmail that run under GNU emacs?

Any help would be appreciated.

Thanks in advance.


--
  Lloyd Zusman                  Internet:  ljz@fx.com
  Master Byte Software                  or ljz%fx.com@ames.arc.nasa.gov
  Los Gatos, California                 or fxgrp!ljz@ames.arc.nasa.gov
  "We take things well in hand."    uucp:  ...!ames!fxgrp!ljz
  [ our Internet connection is down: use uucp or mail to the entry above it ]

jr@PIZZA.BBN.COM (John Robinson) (10/21/88)

> So, I would like to filter my mail in a different manner.  Since I use
> rmail inside of GNU Emacs, it seems to me that it would be nice if the
> 'rmail-get-new-mail' function could optionally filter the messages as
> it takes them from my system mailbox and writes them into my RMAIL
> mailbox.  Some sort of hook could be used for this, I presume.

If you trace the operation of rmail-get-new-mail, youi will find that
it eventually executes:

   (call-process
     (expand-file-name "movemail" exec-directory)
     nil errors nil file tofile)

whic, briefly, calls .../emacs/etc/movemail on the (each) file that
represents your maildrop.  You could achieve whatever filtering you
want by (1) replacing movemail with a shell script that optionally
(perhaps conditoned on an env variable) applies filtering to the file,
or (2) changing exec-directory to point to a directory that contains a
private version of movemail for your purposes, or by (3) rewriting the
lisp function I pulled this from in rmail.el.  The source for movemail
is in .../etc/.

/jr
jr@bbn.com or bbn!jr

rlk@think.com (Robert Krawitz) (10/21/88)

It's a lot cheaper to filter mail using a filter than it is to filter
it in emacs -- emacs lisp is fast, but not as fast as good C code for
one thing, and also the latency involved in emacs sorting the mail
would be pretty bad.  There's a program called pmd (Personal Mail
Daemon) that was written by Jim Aspnes and modified by me that does
just this.  It's available by anonymous ftp from think.com (10.4.0.6)
as pmdc.tar.Z.  You might have to try the ftp several times -- the
/public filesystem is somewhat unreliable, and our network connection
is also somewhat unreliable (off-peak hours work best).
-- 
harvard >>>>>>  |		Robert Krawitz <rlk@think.com>
bloom-beacon >  |think!rlk
topaz >>>>>>>>  .		rlk@a.HASA.disorg