procmail
[Top] [All Lists]

Re: CLEANTO anyone?

2004-05-29 22:10:30
On 29 May, Jim Osborn wrote:
| Before I reinvent a wheel, I thought I'd ask if anyone has a pointer
| to a procmail recipe (using some clever MATCH magic perhaps or
| maybe with a bit of additional sed) that would extract all the
| address portions, minus comments, from a set of commented addresses?
| 
| [...]
| 
| My current motivation is to just count the real addresses, so
| something like:
| 
| :0
| * 1^1 RAWTO ?? regex-that-ignores-comments
| 
| [...]

I think you can count the addresses with something as simple as:

:0
*     ^To:\/.*
* 1^1 MATCH ?? @
{ TOCOUNT = $= }

I found enough times that I wanted a clean list of addresses as
you describe, that I started running a perl one-liner on both the
To: and Cc: headers.  It populates a variable with the count and
the clean list of addresses, which is then split into to separate
variables containing the count and address list, allowing for one
fork to populate both variables.  If this can be done with pure
procmail, I imagine it would probably require recursion.

I make no representation that it's perfect, but it seems to work
ok for gubermint work, as long as you're not adverse to wielding
the perl sledge hammer.  It can be viewed here:

http://www.xray.mpe.mpg.de/mailing-lists/procmail/2003-09/msg00199.html

Hope that helps,

Don Hammond

-- 
Email address in From: header is valid  * but only for a couple of days *
This is my reluctant response to spammers' unrelenting address harvesting


_______________________________________________
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>