procmail
[Top] [All Lists]

Re: Forwarding First Part of Message to alphanumeric pager

2000-02-07 08:00:12
On Sun, 6 Feb 2000 19:02:52 -0500, "Keith Calligan"
<kcalligan(_at_)home(_dot_)com> wrote:
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.

Some related recipes are at <http://www.iki.fi/era/procmail/links.html> 
in the "Pearls" section. Anyway, it all amounts basically to

    :0c
    {
        # Rewrite the body; "flatten" whitespace, then throw away
        #  anything after the 120th character
        :0fbw
        | tr -s '\011\012 ' ' ' | cut -c 1-120

        # Send of the reformatted copy
        :0
        ! 1234567890(_at_)pager-service(_dot_)com
    }

This will keep the header exactly the way it was. If the Subject:
and/or From: headers are somehow significant (i.e. displayed on your
pager), perhaps you want to rewrite them, too.

Food for thought: The following is a valid message;

    From: realaddress(_at_)long(_dot_)email-address(_dot_)example(_dot_)com 
(Donna Who)
    Subject: =?iso8859-1?Q?Apr=E8s_ski_tonight=3F?=
    Content-Type: text/plain; charset=us-ascii
    Content-Transfer-Encoding: base64

    SGksIHdhbm5hIGdvIHRvIHRoZSBiYXIgYWZ0ZXIgdGhlIHBpc3RlcyBjbG9zZT8=

A good pager recipe should probably reformat this into something like:

    From: Donna Who 
<realaddress(_at_)long(_dot_)email-address(_dot_)example(_dot_)com>
    Subject: Apres ski tonight?
    Content-Type: text/plain; charset=us-ascii
    Content-Transfer-Encoding: 7bit

    Hi, wanna go to the bar after the pistes close?

Assumptions:

  * The pager will display the first From: address verbatim,
    but only the name string ("Donna Who") from the second.

  * You don't enjoy reading raw base64 even if it's less than 120
    characters.

  * People you know are not completely unlikely to end up sending you
    stuff like the first example occasionally. I don't know about your
    relatives; mine certainly have a strange, strong but completely
    undeterministic streak when it comes to making mail programs do
    weird things.

You might also want to strip predictable phrases like "Dear Mr.
Calligan" from the very start of a message, which is something which
isn't easy to do with the current recipe, but very easy as a part of a
general "message normalizer" script, if you choose to make one. Then
you'd just pipe all mail through this script before passing it on to
the pager reformatting recipe.

Some versions of tr and/or cut might choke on very large inputs. I
once had the misfortune to work on a NetBSD system where the input
line limit of cut(1) was something like 256 characters ... Upgrade to
the GNU replacements if that's a problem for you. You can find
pointers at <http://www.iki.fi/era/unix/#gnu>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">

Please turn off this "feature" in your "mail client". If you are using
Outkook, I believe the appropriate series of clicks and drools would
be Tools > Options > Send tab > Mail Sending Format > Plain Text

Thanks, and hope this helps,

/* era */

-- 
 Too much to say to fit into this .signature anyway: <http://www.iki.fi/era/>
  Fight spam in Europe: <http://www.euro.cauce.org/> * Sign the EU petition

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