From era@iki.fi Tue Mar 21 16:15:49 2000 Date: Mon, 7 Feb 2000 16:51:37 +0200 (EET) From: era eriksson To: Keith Calligan Cc: procmail@informatik.rwth-aachen.de Subject: Re: Forwarding First Part of Message to alphanumeric pager Resent-Date: Mon, 7 Feb 2000 15:54:22 +0100 (MET) Resent-From: procmail@informatik.rwth-aachen.de On Sun, 6 Feb 2000 19:02:52 -0500, "Keith Calligan" 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 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@pager-service.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@long.email-address.example.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 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 > 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: Fight spam in Europe: * Sign the EU petition