procmail
[Top] [All Lists]

Re: procmail digest, Vol 1 #548 - 6 msgs

2001-07-17 03:09:31
Send procmail mailing list submissions to
 procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE

To subscribe or unsubscribe via the World Wide Web, visit
 http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail
or, via email, send a message with subject or body 'help' to
 procmail-request(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE

You can reach the person managing the list at
 procmail-admin(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE

When replying, please edit your Subject line so it is more specific
than "Re: Contents of procmail digest..."


Today's Topics:

 1. Re: Capture MATCH? (Stan Ryckman)
 2. Re: Recipe for truncating mail body & forwarding to cell phone (Timothy 
Luoma)
 3. Re: splitting emacs RMAIL (Babyl) file w/ formail (Wayne Stewart)
 4. filtering through programs (Justin Buser)
 5. Re: [jf] New procmail 3.21 causes false positives (Gregory Sutter)
 6. Re: Capture MATCH? (James Ervin)

--__--__--

Message: 1
Date: Tue, 17 Jul 2001 00:58:10 -0400 (EDT)
From: Stan Ryckman <stanr(_at_)sunspot(_dot_)tiac(_dot_)net>
Subject: Re: Capture MATCH?
To: procmail-users(_at_)procmail(_dot_)org
Organization: Amber & Sneakers Fan Club

Professional Software Engineering wrote:
At 17:09 2001-07-16 -0400, James Ervin did say:

1. obviously I can not do a variable assignment inside of a
recipe........should I write a scribe that would assign the variable and
pipe it through it......any other ideas?

I don't follow the logic that you cannot perform variable assignment. As
for making a script and piping it through, see below..

I *think* James meant that he could not assign inside of a *script*,
rather than a *recipe*. (Environment variables changed in a child
process are not passed back to the parent process.)

[snip]

2. my first \/ is grabbing everything after "To: " and not stopping at
the @ sign, so even if I could capture it, it still contains the wrong data.

Check docs for MATCH - it doesn't work by stopping at the specified text -
it assigns the match from the beginning of the match to EOL.

Not true; see below.

Which is why you'd pipe the match through sed or something like that. An

Better avoid extra processes (such as sed) when possible.

It doesn't assign from beginning of the match to EOL, but rather from
beginning of the match to as far as can be part of the match
(i.e., "greedy.").

Thus, to stop at the @ sign, James could replace:
 * ^To: \/(_dot_)*(_at_)externalserver(_dot_)mysite(_dot_)org
with, for example, something like this (untested):
 :0
 * ^To:.*\/[^ "<>),@]+(_at_)externalserver\(_dot_)mysite\(_dot_)org
 * MATCH ?? ^\/[^(_at_)]+
 * ... other conditions such as Content-* go here ...
 { NAME="$MATCH" }
 :0a
 ... the forwarding part that uses $NAME goes here ...

The first line selects a correct address into MATCH (note there
are both a space and a tab inside the []), and the second line
gets the part of that before the "@" into another variable, and
no external process is required. (I used NAME instead of USER
just to avoid confusion with a variable many UNIX systems set.)

As you noted, two recipes are needed the way James wrote it
(and also the way I wrote it).

Of course, the recipient could be in Cc: rather than To:,
so "(To|Cc):" could replace "To:" above. However, this won't
work with Bcc at all, and if it goes to more than one user this
will only pick out one (as would the other method).

Cheers,
Stan

--__--__--

Message: 2
Date: Mon, 16 Jul 2001 10:28:40 -0400
From: Timothy Luoma <luomat(_at_)peak(_dot_)org>
Subject: Re: Recipe for truncating mail body & forwarding to cell phone
To: Ana-Maria Ivan <oohp(_at_)MailAndNews(_dot_)com>
Cc: procmail-users(_at_)procmail(_dot_)org


I need to truncate my e-mails at 160 characters and forward them to
my cell phone as SMS messages.

Does that 160 characters also include the From and Subject information?

When trying to do this w/ my SMS service, I made a file with exactly 160
characters and sent it like this:


Mail me(_at_)mycell(_dot_)com < 160charmessage.txt

It was over the limit, so I had to muck with it.

(Actually I eventually gave up trying to truncate the message, and instead I
let the SMS service truncate it for me. They only send the first 160
characters and I have to 'reply' if I want to see more)



Only the body should be truncated, the header is rewritten.

My SMS service truncates the headers on its own, are you sure that yours
does not also?


The only problem is
that the rules below would not truncate massages *exactly* at 160
chars, and even more annoying MIME and uuencode blocks are forwarded
without being truncated at all.

You will gain a newfound hatred of HTML emails also.

See http://www.peak.org/~luomat/procmail/antimime.txt for my method of
killing MIME formatted messages (including HTML) which works fairly well,
but I would only use it AFTER making a backup copy of each message that hits
the recipe, because it does make mistakes.



I searched the entire list archive but haven't found any useful
answers, can someone please give me a recipe for doing this?

I think the archive isn't always helpful for this because it really depends
somewhat on what you want to do


I don't understand why the messages don't always get truncated.

I wonder if trying 150 instead of 160 would help?



--__--__--

Message: 3
Date: Mon, 16 Jul 2001 11:19:47 -0700
From: Wayne Stewart <wstewart(_at_)altaserv(_dot_)net>
Subject: Re: splitting emacs RMAIL (Babyl) file w/ formail
To: guenther(_at_)gac(_dot_)edu
Cc: procmail(_at_)informatik(_dot_)RWTH-Aachen(_dot_)de

"PG" == Philip Guenther <guenther(_at_)gac(_dot_)edu> writes:
 PG> Wayne Stewart <wstewart(_at_)altaserv(_dot_)net> writes:
My reading of the formail man page leads me to believe that I can
produce a standard mailbox file from an emacs RMAIL (Babyl) file
using a command line like:

formail -Bds < RMAIL > mbox.emacs


The emacs 'rmail' package also has a function called 'unrmail'
which converts an RMAIL file into mailbox format. When I compare
what I obtain from 'unrmail' with the output of the above
'formail' command, the two outputs are very different. The
output of emacs 'unrmail' definitely appears to be more correct.
For example, the formail output begins with:

From foo(_at_)bar Tue Jul 10 17:51:09 2001
Summary-line: ...

but the email address "foo(_at_)bar" does not occur in the RMAIL input
file.
 PG> The foo(_at_)bar is a standard sign from formail. To quote the
 PG> second paragraph of the formail(1) manpage:
 PG>
 PG> If formail is supposed to determine the sender of the
 PG> mail, but is unable to find any, it will substitute `foo(_at_)bar'.
 PG>
 PG>
If you're wondering why I don't just use 'unrmail', I want to use
formail to do more sophisticated processing of my RMAIL mailbox
('unrmail' *only* converts the entire RMAIL file to inbox
format). However, first I would like to be assured that formail
is robust and reliable when processing emacs RMAIL/Babyl files.
 PG> I would call formail consistent, but not robust, in its
 PG> conversion of BABYL format files. I suspect it was originally
 PG> added purely to help people converting from RMAIL to other
 PG> packages, but I can't be sure. RMAIL's own unrmail function
 PG> will be more robust and complete, but that's the because it was
 PG> written by the RMAIL people themselves.
 PG>
 PG> While it wouldn't be as efficient, would it sufficient your
 PG> purposes to invoke unrmail as a batch command, using "emacs
 PG> -batch -f...." and then postprocess the resulting file using
 PG> formail and other tools? If not, then hacking unrmail (how good
 PG> are you with elisp?) may be your best bet.
 PG>
 PG>
 PG> Philip Guenther
 PG>

Thanks for the response, Philip. I'm a procmail/formail newbie, so I
just wanted to make sure that it wasn't pilot error on my part. I
gather the '-B' functionality of 'formail' isn't quite "all there",
and it doesn't sound like there are many people trying to use it in
"split" mode.

I wouldn't exactly call formail "consistent", though, in its handling
of BABYL files. The RMAIL file I was attempting to split has 136
messages. Egrep of the output of 'unrmail' finds 136 lines with the
pattern '^From '. The same egrep of the output of formail finds 142
lines matching that pattern, 10 of which contain the address
'foo(_at_)bar'.

Thanks again for the help.

----
 Wayne


--__--__--

Message: 4
Date: Mon, 16 Jul 2001 18:05:27 -0400 (EDT)
From: Justin Buser <jbuser(_at_)ionium(_dot_)com>
Subject: filtering through programs
To: procmail-users(_at_)procmail(_dot_)org
Reply-to: jbuser(_at_)ionium(_dot_)com

I want to use procmail to filter all incoming mail with
a .doc file attachment through something like this

|/usr/bin/munpack -qfC /temp > null

I have read through tons of doc files and example files
and thought I figured it out but it doesn't seem to
work. Will procmail run automatically or does it have
to be started as a daemon? I have a /etc/procmailrc
file but it doesn't seem to be working. I tried a
couple of test things I found in the procmail
documentation but they didn't run.
What changes do I need to make to have this work. I
only want the /etc/procmailrc file to be used and no-one
has shell access to the server besides me. The
attachment rule is the only one I want to run but I want
it to run on all incoming mail to any user. Any help
would be greatly appreciated. Thanx

Justin Buser

--__--__--

Message: 5
Date: Mon, 16 Jul 2001 16:58:13 -0700
From: Gregory Sutter <gsutter(_at_)zer0(_dot_)org>
Subject: Re: [jf] New procmail 3.21 causes false positives
To: junkfilter-users(_at_)yahoogroups(_dot_)com, 
procmail-users(_at_)procmail(_dot_)org
Organization: Zer0


--ZoaI/ZTpAVc4A5k6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2001-07-17 00:03 +0200, Stefan Frank <sfr(_at_)gmx(_dot_)net> wrote:
=20
today i upgraded procmail from 3.15 (Debian version 3.15.1-4) to 3.21
(Debian 3.21-2). Since then junkfilter catches false positives from
two Mailinglists, one of them being the procmail users list ;-).
=20
The version of junkfilter is 20010529.
=20
Here's the spam-header from jf:
=20
X-junkfilter: 20010528
X-Spammer: bodychk: 
mailto:procmail-request(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE?subject=
=3Dsubscribe

This is a junkfilter issue, not a procmail one, and I can't see how
your procmail upgrade could have anything to do with it. junkfilter
2001052[89] checked for the following regex in the message body:

mailto:[a-z0-9][-.a-z0-9_]*@(([a-z0-9][-a-z0-9]+)\.)+$JFTLD\?subject=3D(sub=
scribe|unsubscribe|remove|more_info)

This has since proven to be too common in legitimate email,=20
especially to lists (as you've discovered), and has been=20
changed to this:

mailto:[a-z0-9][-.a-z0-9_]*@(([a-z0-9][-a-z0-9]+)\.)+$JFTLD\?subject=3D(rem=
ove|more_info)

You can find that line in the 'bodychk' file in your junkfilter
distribution, change it to the newer one, and use the 'jf'
utility to rebuild your jf-bodychk file; I've also sent you
an updated bodychk and jf-bodychk by private email.

Greg
--=20
Gregory S. Sutter It is no measure of health to be
mailto:gsutter(_at_)zer0(_dot_)org well adjusted to a profoundly
http://www.zer0.org/~gsutter/ sick society. --Krishamurti
hkp://wwwkeys.pgp.net/0x845DFEDD

--ZoaI/ZTpAVc4A5k6
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Comment: ''

iD8DBQE7U3+VIBUx1YRd/t0RAn4mAJ9DSaB5ThyNzm8cJvGlDWkJchq7hACfXjkX
MX8R6KZdfBO782QuDCe3DsQ=
=idXi
-----END PGP SIGNATURE-----

--ZoaI/ZTpAVc4A5k6--

--__--__--

Message: 6
Date: Mon, 16 Jul 2001 20:35:22 -0400
From: James Ervin <james(_at_)kites(_dot_)org>
Subject: Re: Capture MATCH?
To: procmail-users(_at_)procmail(_dot_)org

Thanks for the feedback. See below:

At 01:55 PM 7/16/2001 -0700, you wrote:

I don't follow the logic that you cannot perform variable assignment. As
for making a script and piping it through, see below..

I think by using the work "obvious" I sounded arrogant, but was trying to
imply that I obviously did not know how to do it. The "Obvious" part to me
was simply that trying to do assignment at that point in the recipe was
failing. In this case I was saying that I tried it and procmail
choked. In the sample I submitted, procmail attempts to deliver to the
"USER=XYZ(_at_)externalserver(_dot_)mysite(_dot_)org", so I jumped the quick 
conclusion that
it was interpreting it as an action.

Note that your TO: line may have MULTIPLE addresses on it... what you're
doing is at least ensuring that the TO: includes an address at
externalserver.mysite.org. To: may also include plaintext name text, not
just raw addresses.

This is a brilliant point that will no doubt save me an embarrassment
later. I had never considered an inbound email to more than one internal
address.



Check docs for MATCH - it doesn't work by stopping at the specified text -
it assigns the match from the beginning of the match to EOL.

Valuable information. Explains why I had too much in \/.

Which is why you'd pipe the match through sed or something like that. An
example:

USERID|=echo $MATCH|sed -e
's/@externalserver.mysite.org/@internalserver.mysite.org/g'

This I can work with. .

What gives with the pipe and forward. Doesn't this upchuck errors at you?

This has never been tested, but I see you point, indeed, should be another
:0 (I through together the example to illustrate my frustrations getting a
variable assigned from MATCH in a recipe.

Here is a revised pass:

:0BH
 * ^To: \/(_dot_)*(_at_)externalserver(_dot_)mysite(_dot_)org
USER|=echo $MATCH|sed -e
's/@externalserver.mysite.org/@internalserver.mysite.org/g'
 * ^Content-(Type|Disposition):.*name=.*\.\/(exe|com|zip|vbs|shs|hta|scr|chm)
 {
 :0f
 | formail -I "X-VIRUSWARNING: This file had a $MATCH attachment"
 :0
 ! $USER
 }

Unfortunately I still get a choke in the log:

procmail: Skipped "james(_at_)externalserver(_dot_)mysite(_dot_)org|sed -e
s/@externalserver.mysite.org/@internalserver.mysite.org/g"
 From james(_at_)kites(_dot_)org Mon Jul 16 19:21:22 2001
 Subject: test
 Folder: USER|=echo

It seems I am still unable to assign variables inside of a recipe......it
still thinks it is an action. What am I missing in the simple assignment
of a variable? Or, do I need to take the assignment out of the :0 all
together?

Thanks again for the information.





James Ervin
james(_at_)kites(_dot_)org
http://www.kites.org



--__--__--

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


End of procmail Digest

_______________________________________________
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>
  • Re: procmail digest, Vol 1 #548 - 6 msgs, dmdoyle <=