LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-24-2008, 03:47 AM   #1
alitrix
Member
 
Registered: Jun 2003
Location: Netherlands, The
Distribution: Ubuntu, Kernel 2.6.7
Posts: 169

Rep: Reputation: 30
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
 
Old 05-24-2008, 06:53 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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
 
Old 05-24-2008, 11:01 AM   #3
alitrix
Member
 
Registered: Jun 2003
Location: Netherlands, The
Distribution: Ubuntu, Kernel 2.6.7
Posts: 169

Original Poster
Rep: Reputation: 30
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
 
Old 05-25-2008, 06:38 AM   #4
alitrix
Member
 
Registered: Jun 2003
Location: Netherlands, The
Distribution: Ubuntu, Kernel 2.6.7
Posts: 169

Original Poster
Rep: Reputation: 30
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
 
Old 05-26-2008, 05:20 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

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


Reply

Tags
attachments, forwarding, procmail


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Procmail forwarding loop jusme Linux - Software 10 02-28-2006 12:51 PM
procmail and forwarding samek Linux - Software 3 09-12-2005 08:18 AM
Removing Attachment With Procmail joseph Linux - Networking 0 02-17-2005 07:32 PM
Forwarding messages to another server via procmail handsomeRob Linux - Software 5 01-18-2005 07:08 PM
Blank emails with no headers??!!!!! (postfix/spamassassin/procmail) birkinshawc Linux - Software 0 03-10-2004 08:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration