procmail
[Top] [All Lists]

Re: How to send From: Subject: and body < 512 bytes to another program?

1999-05-13 10:20:58
  
I need to send all emails from root to a pager program. I have the 
following in my .procmailrc. How can I send From: Subject: and Body < 512
bytes to my other program? Has anyone done this? The following egrep gets
me the From and Subject lines, but I am unable to get the body content. 
Any insights, solutions, help? 

:1Hbc
* ^From[ :].*root
| (egrep -e 'From:|Subject:') | /opt/epage/bin/pagerprogram -s unixsysadm -

Here's what I do:

:0 ci
* $ !^$list_header
| /home/mshaw/bin/mailnotify -number 5981529 -after 7 -before 18 -days MTWRF

This recipe keeps a copy of the mail in the default mailbox, and
excludes some mail based on values in the header, which doesn't
have much to do with your question.  More to the point, it forwards
the *entire* message to 'mailnotify', and that script extracts the 
sender and subject information, and throws away any body text beyond
the limit the pager can handle.  Note also that I have switches 
limiting the time of day and days of the week the forwarding will be
done.

You don't say whether you have control of 'pagerprogram' or, if you 
do, whether modifying it is an option.  If you don't want to or can't 
change it, maybe you could use something like what I have as a wrapper
around it, or insert it in the pipeline in place of your egrep....

If you want a copy of 'mailnotify', let me know and I'll email it
separately.  It's not huge, but it's a little too big to include here.

Best regards,
Mark Shaw

===========================================================================
Mark N. Shaw                     Telephone/fax:   (972) 480-4018/4333
ASIC Product Applications        CES Alpha Pager: (972) 598-1529
Texas Instruments                Email:           mshaw(_at_)ti(_dot_)com
PO Box 660199, MS 8666           MSGID:           MNS1
Dallas, Texas 75266              Intranet:        www.dal.asp.ti.com/~mshaw
---------------------------------------------------------------------------
You can also page me by emailing with subject "PAGERMAIL" -- 400 char limit 
===========================================================================