procmail
[Top] [All Lists]

Re: unsubscribing" a user based on "from" address.

2001-10-03 17:12:49
On Wed, Oct 03, 2001 at 10:33:26AM -0400, Colin J. Raven wrote:
So here's the situation, I grabbed a file from the user called
"email1.txt" which apparently contains 399,000 email addresses, and
there are hundreds of emails coming in addressed to "unsuscribe"...yeah,
you guessed it....how could I delete those email addresses out of that
file using the To: unsubscribe(_at_)domain(_dot_)com) and using the "From:"
address?  matching an email address in this huge text file, then
deleting it if there's a match. I'm swamped with this, and the user's
manager is saying that he needs all unsuscribes deleted from that file.
Manually this would take forever, there has to be a better way using
procmail.

Performance wise, You'd probably be better off putting that huge file in some
kind of database and deleting entries from that as they come in. But since I'm
by no means a database guru, I'll leave it for someone else to help with that
(that's beyond the scope of procmail anyway).
Now, for just a flat file, this isn't hard. I'm assuming this is a file of
RFC 822/2822 "addr-specs" (local-parrt(_at_)domain(_dot_)tld only).

:0h
* ^TOunsubscribe
FROM=|formail -rt -xTo:
{
        :0:
        | sed s/$FROM// < email1.txt > email1.tmp; mv email1.tmp email1.txt 
}

It's not the most efficient, but it will work.

-- 
Andrew Edelstein        -       andrew(_at_)pure-chaos(_dot_)com
http://andrew.pure-chaos.com

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