procmail
[Top] [All Lists]

Re: New Mail

1996-07-10 22:33:02
The Raven <lolson(_at_)acc(_dot_)jc(_dot_)edu> writes:
On Wed, 10 Jul 1996, Eric D. Berg wrote:
I use this to inform me of mail from my wife.  xmessage pops up a window on
your xdisplay, but you can easily just change this to `echo`.


FROM=`formail -rtzxTo:`
DISPLAY="bluedog:0.0"
SUBJ=`formail -rtzxSubject:`
:0 c
* FROM ?? mywife(_at_)herjob(_dot_)com
|  xmessage  "$FROM: $SUBJ"  &

-Eric.

I inserted this recipe into my .procmailrc fil, but nothing happens.

FROM=`formail -rtzxTo:`
SUBJ=`formail -rtzxSubject:`
:0 c
| echo "You have new mail from $FROM about $SUBJ" &

I used mail lolson < file to test it, the mail got there, but th mssage 
wasn't displayed.

The "xmessage" command is a X windows client program that displays the
string passed as an argument in a pop up window.  That's how it "gets
the word out".  "echo" simply sends its output to its stdout, which for
actions in recipes is the stdout of procmail.  When procmail is invoked
by sendmail, stdout is, if the delivery failed, captured and mailed
back to the message envelope sender.  Otherwise, such as here, it's
thrown away.

What that's all trying to say is that if you want to display something
on your screen, you need a program that can do it for you.  Procmail
has no magic to figure out where you're logged in.

Since you write:

Until NeXTime,

it sounds like you're on a machine running NeXTStep, and thus probably
can't just use something simple like "xmessage".  You may be able to
get away with using biff/comsat.  The former marks your current
terminal as 'biffable', while the latter is a daemon that, when sent a
packet with a login name and mailbox offset, will hunt for 'biffable'
terminals owned by that login, and write a message to it/them
containing the first few lines of the mail message.  Procmail will send
the requisite packet if the COMSAT variable is on/enabled/true.
However, older versions of the comsat daemon (most OSes) only work for
mail delivered on the local machine (they won't accept packets from
across the network), and this thus would only work if you're logged
into the mail server.  This is fine if you have only one machine, but
with today's networks biff/comsat has fallen out of favor.

Still other solutions exist, varying from the overly clever to the
bruteforce.  In the former category falls various tricks involving
having your .login write your location (machine & port) to a file, then
a small script is run from your .procmailrc that reads this and rsh's
to that machine where it spits a small message to that tty.  Getting
this right is not for the faint-at-heart, and mistakes may annoy your
sysadmin.  In the category of bruteforce lies elm's "newmail" program,
which sits in the background, checking the specified files for new mail
every N seconds (i.e., polled rather than triggered design).


[11 line ascii art sig deleted]

So you know, my mail filter seems to sometimes lose messages with
sigs longer than ~6 lines.  This one apparently got through, but it
seems fairly random, so...

Of course, this filter is implemented in gray matter.

Philip Guenther

<Prev in Thread] Current Thread [Next in Thread>