procmail
[Top] [All Lists]

Email to Pager recipe

2001-11-22 22:44:23
I have been working on an automated email to pager recipe. I wanted to send
an indication that email had arrived, the subject and sender and possibly an
extract of the message.

I ended up using two separate pages for each email. One for the subject and
sender and the next for the message.

I have removed all new lines and multiple tabs/spaces from the message, and
taken the first 130 odd characters from the beginning. Mpage.pl is a perl
script that sends the message to an SMS gateway.

This is the recipe that I ended up with:

SUBJECT=`formail -zxSubject:`
FROM=`formail -b -rtzxTo:`
MESSAGE=`formail -I "" | sed ':a;N;s/^\n//;s/[\n        ]\{1,\}/ /g;ta;' |
head -c 134`...

:0c: lock1
| mpage.pl 12345678 UFEmail! Fr:$FROM Sub:$SUBJECT

:0c: lock2
| mpage.pl 12345678 Em:$MESSAGE


This seems to work OK.

I would welcome any comments for improvement. I have specific questions on
assigning the variables before the actual recipes - is it better to do this,
or to use the VAR=|commands structure? Also, I'm not sure about extra flags
needed, I seem to be piping each message to mpage unnecessarily? Would it be
more efficient just to put the whole procedure into a shell script, and just
use procmail to call that?

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>
  • Email to Pager recipe, Kevin Myers <=