procmail
[Top] [All Lists]

Re: FROM_DAEMON on preventing loops

2008-09-25 17:38:26


Professional Software Engineering wrote:
At 15:30 2008-09-25 -0400, Skip Morrow wrote:
I am writing a recipe to forward mail to another account. Virtually every example I have seen includes use of the FROM_DAEMON conditional statement.
 Reviewing the recipe, it really looks to me that the real work is being
done by the X-Loop: header being added.  My question is, are the
FROM_DAEMON (and FROM_MAILER) conditionals really necessary?

A mailer daemon is more likely to completely encapsulate your message (so the X-Loop is quoted in the body). Also, often, you don't want to FORWARD bounce messages - esp. if they're bounces of your forwarding attempts.

Good point.  I didn't think of that.

The reason why I ask is that I have seen some emails not get forwarded
(namely from google itself, but they weren't in a loop) and I want to make

Well, check the logs and determine WHY those individual messages were not forwarded. Were they possibly filtered PRIOR to the forwarding recipe?

I started off doing that, but the regular expression is just too hard. Perhaps one of you can tell me where it hit??? (I snipped the expansion of the FROM_DAEMON line).

procmail: Assigning "LASTFOLDER=/home/peloruso/mailstat.sh"
procmail: Match on "(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope|Apparently(-Resent)?)-To):(.*[^-a-zA-Z0-9_.])?)skip(_at_)pelorus\(_dot_)org" procmail: No match on ! "(^(Mailing-List:|Precedence:.*(junk|bulk|list)|To: Multiple recipients of |(((Resent-)?(From|Sender)|X-Envelope-From):|>?F <<snip>> procmail: Assigning "LASTFOLDER=/home/peloruso/mail/pelorus.org/skip/new/1222359373.21205_1.box106.bluehost.com"
From skip(_dot_)x(_dot_)mobile+gmcfvbd1017b67383a123(_at_)gmail(_dot_)com Thu 
Sep 25 10:16:04 2008
Subject: Gmail Confirmation - Send Mail as skip(_at_)pelorus(_dot_)org
Folder: /home/peloruso/mail/pelorus.org/skip/new/1222359373.21205_1. 4756

Here's my recipe again:

 :0
 * ^TO_skip(_at_)pelorus\(_dot_)org
 * !^FROM_DAEMON
 * !^FROM_MAILER
 * !^X-Loop: pelorus.org
 {
   :0fw:${PMDIR}/formail.lock
   | /usr/bin/formail -A "X-Loop: pelorus.org"

   :0c
   !skip(_dot_)x(_dot_)mobile(_at_)gmail(_dot_)com
 }

 :0
 $DEFAULT

And here are the headers from the email in question:

Received: from qb-out-1314.google.com ([72.14.204.172])
        by box106.bluehost.com with esmtp (Exim 4.69)
        (envelope-from 
<skip(_dot_)x(_dot_)mobile+gmcfvbd1017b67383a123(_at_)gmail(_dot_)com>)
        id 1KitVc-0005Ve-8J
        for skip(_at_)pelorus(_dot_)org; Thu, 25 Sep 2008 10:16:04 -0600
Received: by qb-out-1314.google.com with SMTP id e19so381693qbe.0
       for <skip(_at_)pelorus(_dot_)org>; Thu, 25 Sep 2008 09:16:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
       d=gmail.com; s=gamma;
       h=domainkey-signature:received:message-id:date:from:to:subject
        :mime-version:content-type:content-transfer-encoding
        :content-disposition:x-google-address-confirmation;
       bh=LkTaiEhzVU5jsH/d0WdpP6K4f8+ZFJbiQTHDiFXAo70=;
       b=AulQy7gvk3Ji3OuzMLzUT9haV1Xia3bMYxkGNlqBpTJIyR84b2dzUvOR6yHM/MpIVd
        I/9wBIwmcTf/aQPHfuwLUMQVZ48lTNDRIHFxQhxlChnpB14GRSW/DI0DqdPefkDjPmEt
        2bRThKUxxvLmTAQFS3Rz1R0GbfzYHg3cvLJas=
DomainKey-Signature: a=rsa-sha1; c=nofws;
       d=gmail.com; s=gamma;
       h=message-id:date:from:to:subject:mime-version:content-type
        :content-transfer-encoding:content-disposition
        :x-google-address-confirmation;
       b=amcf1wEGOMYLtJy9mD2ET+iWUd/FhYatSlYVgvQkfy3KaMrVi5dFa3B53FXJr2F3gA
        0cqM0H2WJeHOUfIM78jAR1f3UWGxDUmFjJ7lu2DWCq+PM7e4JYslvIXfwZ0dYbzstQQ5
        mS7AJwWRcRxi7zmW3j0QRN39AGO8IYBqkl97E=
Received: by 10.187.212.14 with SMTP id o14mr2553290faq.14.1222359363453;
       Thu, 25 Sep 2008 09:16:03 -0700 (PDT)
Message-ID: <bd1a79480809250916n123dbbf5w(_at_)mail(_dot_)gmail(_dot_)com>
Date: Thu, 25 Sep 2008 12:16:03 -0400
From: "Gmail Team" <mail-noreply(_at_)gmail(_dot_)com>
To: skip(_at_)pelorus(_dot_)org
Subject: Gmail Confirmation - Send Mail as skip(_at_)pelorus(_dot_)org
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
X-Google-Address-Confirmation: XXXXXXX


--
Get my PGP Public key here:
http://pelorus.org/skip(_at_)pelorus(_dot_)org_public_key(_dot_)asc

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail