LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   procmail removing headers after forwarding (https://www.linuxquestions.org/questions/linux-server-73/procmail-removing-headers-after-forwarding-644448/)

alitrix 05-24-2008 03:47 AM

procmail removing headers after forwarding
 
Hi,

For some reason procmail isnīt duplicating the whole email when itīs forwarding.

/etc/procmail
Code:

PATH=/usr/local/bin:/usr/bin:/bin
MAILDIR=$HOME/.mailbox/
DEFAULT=$HOME/.mailbox/
LOGFILE=$MAILDIR/from  #recommended


:0Hh
* .*\@letscall.nl
.INBOX.aliLC/new/.

This should forward emails that are ment for *@letscall.nl to a IMAP-subdir.
Don't look at the procmail-rules, those work fine. I just wanted to test something.


Orginal email (~/testmail.txt):
Code:

Return-Path: <alitrix@gmail.com>
X-Original-To: alitrix@localhost
Delivered-To: alitrix@localhost
Received: by alitrix.nl (Postfix, from userid 1007)
        id 3011362C1D0; Sat, 24 May 2008 16:36:30 +0200 (CEST)
X-Spam-Checker-Version: SpamAssassin 3.1.4 (2006-07-26) on r1k7s19.kdiss.com
X-Spam-Level: **
X-Spam-Status: No, score=2.1 required=5.0 tests=HTML_MESSAGE,
        HTML_SHORT_LENGTH,MISSING_SUBJECT,NO_RECEIVED,TO_CC_NONE autolearn=no
        version=3.1.4
Received: from r1k7s19.kdiss.com (localhost [127.0.0.1])
        by alitrix.nl (Postfix) with ESMTP id 0FA6762C082
        for <alitrix@localhost>; Sat, 24 May 2008 16:36:25 +0200 (CEST)
Envelope-to: ali@letscall.nl
Delivery-date: Sat, 24 May 2008 10:31:52 +0200
Received: from mail.letscall.nl [81.4.97.190]
        by r1k7s19.kdiss.com with POP3 (fetchmail-6.3.4)
        for <alitrix@localhost> (single-drop); Sat, 24 May 2008 16:36:25 +0200 (CEST)
Received: from an-out-0708.google.com ([209.85.132.246])
        by blade24.geenpunt.nl with esmtp (Exim 4.63)
        (envelope-from <alitrix@gmail.com>)
        id 1JzpAN-0000qQ-DS
        for ali@letscall.nl; Sat, 24 May 2008 10:31:51 +0200
Received: by an-out-0708.google.com with SMTP id c38so237616ana.3
        for <ali@letscall.nl>; Sat, 24 May 2008 01:31:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type;
        bh=rlbtInY6KRTZg0R8gzXdHCminImaA5sLZtcOoPQAAD4=;
        b=c2CdtRt/vaakBxGxaz6Iiyfr2FErj8dffVPizEapTaJtG1mssK1oj29gb0js2IUxtMHmZQDSWRsm4t0ddTco776JT2IKmS/JNZPWwbL9XfwaO3BT2sfbOkKKgsXYQVPN/l88MYTsGAaxilq0adJ8ssSCQ9HHVA30f8niMHgeKaQ=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=message-id:date:from:to:subject:mime-version:content-type;
        b=MGQh090HWftfq/Rebq8uS3wvFJiBvM0YMUIvkzU7wJDr9hQFWN0QM5+vW7gazH61BvxqEir22sH1434MeXsVLgqPZ4vZ6062AGwD5CgJaVzGughA0Eu6t/cTOADTwuJTulbJ8BZjND/9CWq8aW6jjDVaVkrhLpucZlmfGVVBscU=
Received: by 10.100.228.17 with SMTP id a17mr3425165anh.100.1211617909932;
        Sat, 24 May 2008 01:31:49 -0700 (PDT)
Received: by 10.100.178.6 with HTTP; Sat, 24 May 2008 01:31:49 -0700 (PDT)
Message-ID: <d004dafc0805240131o77b5693ajf58f76dce941508b@mail.gmail.com>
Date: Sat, 24 May 2008 10:31:49 +0200
From: "Alitrix aka Ali" <alitrix@gmail.com>
To: ali@letscall.nl
Subject: testing.... with new stuff
MIME-Version: 1.0
Content-Type: multipart/alternative;
        boundary="----=_Part_17727_13626508.1211617909927"

------=_Part_17727_13626508.1211617909927
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

adfasdf
asd
f
asdf

------=_Part_17727_13626508.1211617909927
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

adfasdf<br>asd<br>f<br>asdf<br>

------=_Part_17727_13626508.1211617909927--

Forwarded mail (too ~/.mailbox/.INBOX.aliLC/new/):
Code:

Return-Path: <alitrix@gmail.com>
X-Original-To: alitrix@localhost
Delivered-To: alitrix@localhost
Received: by alitrix.nl (Postfix, from userid 1007)
        id 3011362C1D0; Sat, 24 May 2008 16:36:30 +0200 (CEST)
X-Spam-Checker-Version: SpamAssassin 3.1.4 (2006-07-26) on r1k7s19.kdiss.com
X-Spam-Level: **
X-Spam-Status: No, score=2.1 required=5.0 tests=HTML_MESSAGE,
        HTML_SHORT_LENGTH,MISSING_SUBJECT,NO_RECEIVED,TO_CC_NONE autolearn=no
        version=3.1.4
Received: from r1k7s19.kdiss.com (localhost [127.0.0.1])
        by alitrix.nl (Postfix) with ESMTP id 0FA6762C082
        for <alitrix@localhost>; Sat, 24 May 2008 16:36:25 +0200 (CEST)
Envelope-to: ali@letscall.nl
Delivery-date: Sat, 24 May 2008 10:31:52 +0200
Received: from mail.letscall.nl [81.4.97.190]
        by r1k7s19.kdiss.com with POP3 (fetchmail-6.3.4)
        for <alitrix@localhost> (single-drop); Sat, 24 May 2008 16:36:25 +0200 (CEST)
Received: from an-out-0708.google.com ([209.85.132.246])
        by blade24.geenpunt.nl with esmtp (Exim 4.63)
        (envelope-from <alitrix@gmail.com>)
        id 1JzpAN-0000qQ-DS
        for ali@letscall.nl; Sat, 24 May 2008 10:31:51 +0200
Received: by an-out-0708.google.com with SMTP id c38so237616ana.3
        for <ali@letscall.nl>; Sat, 24 May 2008 01:31:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type;
        bh=rlbtInY6KRTZg0R8gzXdHCminImaA5sLZtcOoPQAAD4=;
        b=c2CdtRt/vaakBxGxaz6Iiyfr2FErj8dffVPizEapTaJtG1mssK1oj29gb0js2IUxtMHmZQDSWRsm4t0ddTco776JT2IKmS/JNZPWwbL9XfwaO3BT2sfbOkKKgsXYQVPN/l88MYTsGAaxilq0adJ8ssSCQ9HHVA30f8niMHgeKaQ=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=message-id:date:from:to:subject:mime-version:content-type;
        b=MGQh090HWftfq/Rebq8uS3wvFJiBvM0YMUIvkzU7wJDr9hQFWN0QM5+vW7gazH61BvxqEir22sH1434MeXsVLgqPZ4vZ6062AGwD5CgJaVzGughA0Eu6t/cTOADTwuJTulbJ8BZjND/9CWq8aW6jjDVaVkrhLpucZlmfGVVBscU=
Received: by 10.100.228.17 with SMTP id a17mr3425165anh.100.1211617909932;
        Sat, 24 May 2008 01:31:49 -0700 (PDT)
Received: by 10.100.178.6 with HTTP; Sat, 24 May 2008 01:31:49 -0700 (PDT)
Message-ID: <d004dafc0805240131o77b5693ajf58f76dce941508b@mail.gmail.com>
Date: Sat, 24 May 2008 10:31:49 +0200
From: "Alitrix aka Ali" <alitrix@gmail.com>
To: ali@letscall.nl
Subject: testing.... with new stuff
MIME-Version: 1.0
Content-Type: multipart/alternative;
        boundary="----=_Part_17727_13626508.1211617909927"

I tested it on 2 ways:
  1. Through mailbox_command in /etc/postfix/main.cf
  2. Through 'procmail < ~/testmail.txt'

Both forward the email correct, but everything after the "Content-Type" is removed :(


Does somebody know what's going on?

Greetz,

Ali

unSpawn 05-24-2008 06:53 AM

Add these lines to the procmail recipe file, then check the log?
Code:

PATH=/usr/local/bin:/usr/bin:/bin
VERBOSE=on
DROPPRIVS=yes
LOGABSTRACT=all
LOGFILE=$HOME/.procmail.log

MAILDIR=$HOME/.mailbox/
DEFAULT=$HOME/.mailbox/
LOGFILE=$MAILDIR/from  #recommended


alitrix 05-24-2008 11:01 AM

Code:

alitrix@r1k7s19:~/.mailbox/cur$ procmail < 1211666195.V806I64c00fM235567.r1k7s19.kdiss.com\:2\,S
procmail: [6085] Sat May 24 23:59:38 2008
procmail: Assigning "DROPPRIVS=yes"
procmail: Assuming identity of the recipient, VERBOSE=off

~/.procmail.log is empty :(
Code:

alitrix@r1k7s19:~$ cat .procmail.log
alitrix@r1k7s19:~$


If I modify the config too this:
Code:

PATH=/usr/local/bin:/usr/bin:/bin
VERBOSE=on
LOGABSTRACT=all
LOGFILE=$HOME/.procmail.log
MAILDIR=$HOME/.mailbox/
DEFAULT=$HOME/.mailbox/
LOGFILE=$MAILDIR/from  #recommended


:0Hh
* .*\@letscall.nl
.INBOX.aliLC/new/.

I get this:
Code:

alitrix@r1k7s19:~/.mailbox/cur$ procmail < 1211666195.V806I64c00fM235567.r1k7s19.kdiss.com\:2\,S
procmail: [6187] Sun May 25 00:04:12 2008
procmail: Assigning "LOGABSTRACT=all"
procmail: Assigning "LOGFILE=/home/alitrix/.procmail.log"
procmail: Opening "/home/alitrix/.procmail.log"

Code:

alitrix@r1k7s19:~/.mailbox/cur$ cat /home/alitrix/.mailbox//from
From alitrix@gmail.com  Sat May 24 06:15:22 2008
 Subject: joh, en nu werken!
  Folder: .INBOX.aliLC/new/1                                              2537
From alitrix@gmail.com  Sat May 24 06:15:24 2008
 Subject: Fwd: Daisycon Week 21 (Account: 58alitri)
  Folder: .INBOX.aliLC/new/1                                              2702
From alitrix@gmail.com  Sat May 24 06:16:38 2008
 Subject: testing
  Folder: .INBOX.aliLC/new/1                                              2525
From alitrix@gmail.com  Sat May 24 06:30:12 2008
 Subject: working with new bash script
  Folder: .INBOX.aliLC/new/1                                              2558
 Subject: testing.... with new stuff
  Folder: .INBOX.aliLC/new/1                                              2496
 Subject: testing.... with new stuff
  Folder: .INBOX.aliLC/new/1                                              2496
 Subject: testing.... with new stuff
  Folder: .INBOX.aliLC/new/2                                              2496
 Subject: testing in LC zelf
  Folder: .INBOX.aliLC/new/1                                              2487
 Subject: testing in LC zelf
  Folder: .INBOX.aliLC/new/1                                              2487
procmail: Match on ".*\@letscall.nl"
procmail: Assigning "LASTFOLDER=.INBOX.aliLC/new/1"
procmail: Opening ".INBOX.aliLC/new/1"
procmail: Acquiring kernel-lock
procmail: Notified comsat: "alitrix@0:/home/alitrix/.mailbox//.INBOX.aliLC/new/1"
 Subject: testing in LC zelf
  Folder: .INBOX.aliLC/new/1                                              2487
procmail: Match on ".*\@letscall.nl"
procmail: Assigning "LASTFOLDER=.INBOX.aliLC/new/1"
procmail: Opening ".INBOX.aliLC/new/1"
procmail: Acquiring kernel-lock
procmail: Notified comsat: "alitrix@0:/home/alitrix/.mailbox//.INBOX.aliLC/new/1"
 Subject: testing in LC zelf
  Folder: .INBOX.aliLC/new/1                                              2487


alitrix 05-25-2008 06:38 AM

Problem solved.

I asked the ppl on the procmail-list. This is the answer:
Code:

You have several problems here:

'H' is the default (egrep headers) and doesn't need to be specified.
'h' specifically tells procmail to only deliver headers to the
filter/mbox/maildir

If you remove both you'll get the behavior you want.

Also, you shouldn't deliver directly to /new/ but just to the maildir
and let procmail handle putting emails in new.

With your regex, you should probably use ^TO or ^TO_.  You don't need
to escape '@' but you do need to escape '.'.  Your leading '.*' is
meaningless in the context that you are using it.

Try changing the recipe to:

:0
* ^(To|Cc):.*@letscall\.nl
.INBOX.aliLC/


Brandon


unSpawn 05-26-2008 05:20 AM

Thanks for posting. It kind of confirms what I suspected, just didn't get around to testing it.


All times are GMT -5. The time now is 04:24 PM.