On Sun, 6 Feb 2000, Keith Calligan wrote:
Hi,
I've been doing a lot of research on the subject of using procmail to forward
messages to an alphanumeric pager but haven't seen anything that is exactly
what I am looking for.
I have procmail functional on my server and it is working properly. What I
need is a recipe that forwards all email to my alphanumeric pager's email
address. I only need to forward the sender, subject, and the first 200
characters of the body to my pager.
Everything else I've seen involves breaking the messages down into a bunch of
smaller messages. I just need the first part of the message sent to my pager.
Thanks,
Keith Calligan
kcalligan(_at_)home(_dot_)com
http://www.nwiserv.com
Keith,
You can do this with a Perl script. Set up a recipe:
:0 c
{
:0 fw: perl.lock
| /path/to/filter.cgi
:0 a
! email(_at_)pager(_dot_)com
}
Use the following Perl script. Place it in a file called filter.cgi (you
can give it any name as long as it's the same one you use in the recipe),
and chmod 755 filter.cgi.
#!/usr/local/bin/perl
# filter.cgi
# This program is used as the filter for mail forwarded to my pager
while (<>) {
if (1 ... /^$/) {
if (m/From:.*/) {
$header .= $&."\n";
}
if (m/Subject:.*/) {
$header .= $&."\n";
}
} else {
$body .= $_;
last if length($body) > 200;
}
}
$body =~ m/.{1,200}/s;
$body = $&;
print "$header\n$body";
Glen