procmail
[Top] [All Lists]

Re: I think I goofed, now what?

2002-01-29 11:13:24
At 11:19 2002-01-29 -0600, user(_at_)mail(_dot_)rineco(_dot_)com wrote:

My question is this, is there any way for me to now send these emails to
their respective recipient(s).  The emails are in their original format,
they just all happen to be in one file now and I've tried a few things,
but I can't seem to get them to who they were actually sent to.

Pray that you didn't have a pile of them, and that you have a maillog file (/var/log/maillog or whatever you have sendmail logging to). Grep the maillog, and you should be able to find the local recipients of most of those messages. I'm not going to sit here and write a script for you to do this (it doesn't involve procmail anyway, excepting that you'd use 'formail -s' to split the message archive and invoke a shell script or perl program to do the dirty work). Basically, you'd have to extract the local (topmost) SMTP id tag from the received headers in each message, then grep the maillog for those and process the mail log for local recipients. Here's an example:

From the top of a recent message I recieved:

Return-Path: <mysql-return-97867-someaddr(_at_)lists(_dot_)mysql(_dot_)com>
Received: from web.mysql.com (IDENT:qmailr(_at_)web(_dot_)mysql(_dot_)com 
[192.58.197.162])
        by myserver.tld (8.10.2/8.11.1) with SMTP id g0THdCp21556
        for <someaddr(_at_)myserver(_dot_)tld>; Tue, 29 Jan 2002 09:39:12 -0800
Received: (qmail 31250 invoked by uid 7797); 29 Jan 2002 16:52:56 -0000
Mailing-List: contact mysql-help(_at_)lists(_dot_)mysql(_dot_)com; run by ezmlm (http://www.ezmlm.org)

See that SMTP id bit? You'll need to parse your saved messages and try to locate something like that. Note that your server may or may not be adding the "for <addr>" part, and on messages where there are multiple local recipients, that wouldn't appear anyway. Then, you'll grep your maillog for that id string:

Jan 29 09:39:13 trei sendmail[21556]: g0THdCp21556: from=<mysql-return-97867-someaddr(_at_)lists(_dot_)mysql(_dot_)com>, size=2611, class=-60, nrcpts=1, msgid=<20020129170642(_dot_)4C4251377B(_at_)smtp(_dot_)h3technology(_dot_)com>, proto=SMTP, daemon=MTA, relay=IDENT:qmailr(_at_)web(_dot_)mysql(_dot_)com [192.58.197.162]

Jan 29 09:39:18 trei sendmail[21557]: g0THdCp21556: to=<someaddr(_at_)myserver(_dot_)tld>, delay=00:00:06, xdelay=00:00:04, mailer=local, pri=139725, dsn=2.0.0, stat=Sent

You'll have to take it from there - this isn't a procmail issue.

If you cannot get the actual user addresses for which messages were intended, well, bugger for you. Bet you'll make sure to run tests on a separate box from now on, or be absolutely sure that the MTA is shut down before hacking the config.

I've tried using something like:
cat file_will_the_emails|formail -s sendmail -t

That's evil and will get your users kicked from a number of mailing lists and will undoubtedly annoy other people who received messages addressed to multiple recipients (to/cc), who will receive an extra copy of those messages each time you try to run this and scratch your head wondering why all the messages aren't being locally delivered.

Look at THIS message for instance - the TO: is the procmail list, not you. Thus, sendmail would end up examining the message handed to it by formail and seeing that it was addressed TO: procmail and send it back here.

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

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