A little sieve help

Patrick Baldwin <Patrick.Baldwin@studsvik.com> Wed, 10 December 2008 22:37 UTC

Return-Path: <owner-ietf-mta-filters@mail.imc.org>
X-Original-To: ietfarch-sieve-archive-Aet6aiqu@core3.amsl.com
Delivered-To: ietfarch-sieve-archive-Aet6aiqu@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 8249B3A69E2 for <ietfarch-sieve-archive-Aet6aiqu@core3.amsl.com>; Wed, 10 Dec 2008 14:37:09 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id arij0KQQr9Y7 for <ietfarch-sieve-archive-Aet6aiqu@core3.amsl.com>; Wed, 10 Dec 2008 14:37:08 -0800 (PST)
Received: from balder-227.proper.com (properopus-pt.tunnel.tserv3.fmt2.ipv6.he.net [IPv6:2001:470:1f04:392::2]) by core3.amsl.com (Postfix) with ESMTP id 62DBD3A6973 for <sieve-archive-Aet6aiqu@ietf.org>; Wed, 10 Dec 2008 14:37:07 -0800 (PST)
Received: from balder-227.proper.com (localhost [127.0.0.1]) by balder-227.proper.com (8.14.2/8.14.2) with ESMTP id mBAMU1xM070815 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 10 Dec 2008 15:30:01 -0700 (MST) (envelope-from owner-ietf-mta-filters@mail.imc.org)
Received: (from majordom@localhost) by balder-227.proper.com (8.14.2/8.13.5/Submit) id mBAMU1Zw070814; Wed, 10 Dec 2008 15:30:01 -0700 (MST) (envelope-from owner-ietf-mta-filters@mail.imc.org)
X-Authentication-Warning: balder-227.proper.com: majordom set sender to owner-ietf-mta-filters@mail.imc.org using -f
Received: from bostonserver.studsvik-analytic.com (firewall.studsvik-analytic.com [155.212.59.75]) by balder-227.proper.com (8.14.2/8.14.2) with ESMTP id mBAMTxkH070798 for <ietf-mta-filters@imc.org>; Wed, 10 Dec 2008 15:30:00 -0700 (MST) (envelope-from Patrick.Baldwin@studsvik.com)
Received: from [192.168.169.115] (eddie [192.168.169.115]) by bostonserver.studsvik-analytic.com (8.12.5/8.12.5) with ESMTP id mBAML5fv004642 for <ietf-mta-filters@imc.org>; Wed, 10 Dec 2008 17:21:05 -0500 (EST)
Message-ID: <49404348.8090304@studsvik.com>
Date: Wed, 10 Dec 2008 17:31:36 -0500
From: Patrick Baldwin <Patrick.Baldwin@studsvik.com>
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
To: ietf-mta-filters@imc.org
Subject: A little sieve help
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 7bit
X-MailScanner: Found to be clean
Sender: owner-ietf-mta-filters@mail.imc.org
Precedence: bulk
List-Archive: <http://www.imc.org/ietf-mta-filters/mail-archive/>
List-ID: <ietf-mta-filters.imc.org>
List-Unsubscribe: <mailto:ietf-mta-filters-request@imc.org?body=unsubscribe>

Hi, I'm in the process of moving my mail to a new server, which will be 
using sieve
instead of procmail.  I've run into some difficulty, and this list was 
the only one I could
find mentioned in conjunction with sieve; if this is an inappropriate 
venue for my questions,
my apologies.

First I tried the conversion script mentioned in:

http://dovecot.org/list/dovecot/2007-March/020895.html

But that didn't produce any output.

I'm trying to turn this procmail script into a sieve script (alterations 
from real
script in <>):

:0
* ^TO_(online)
| /usr/local/bin/dmail +online

:0
* ^TO_(support|internal)
| /usr/local/bin/dmail +Support

:0
* ^From:.ship@.*(<company-name>\.com)
| /usr/local/bin/dmail +SHIPMENTS

:0c
* !^FROM_DAEMON
* !^FROM_MAILER
* !^X-Loop: to_gmail
| (formail -i"Cc:" -I"To: <user name>@gmail.com" \
               -A"X-Loop: to_gmail" \
  ) | $SENDMAIL -t

:0
| /usr/local/bin/dmail


In sieve, I was thinking something like:

require ["fileinto","regex","envelope"];

if address :is "To" "online" {
  fileinto "online";
} elsif address :is "To" "Support" { 
  fileinto "Support";

if address :is "From" "<ship address>" {
  fileinto "SHIPMENTS";
}

redirect "<user name>@gmail.com";
keep;

stop;


...but I'm really not sure.  I also haven't figured out how to have sieve
insert a header to avoid mail loops like I did with procmail.

Any help much appreciated.

Regards,

-- 
Patrick Baldwin
Systems Administrator
Studsvik Scandpower
617-965-7455