Sieve Advice Needed, Please

Casey Bralla MailList at nerdworld.org
Fri Oct 24 02:26:13 UTC 2014


Anybody here familiar with the Sieve language?

I'm rebuilding my mail server, and I am working with the sieve language to
automatically filter spam into a separate account.  However, I've hit a
snag that I can't get around.

BTW, I'm using a clean install of dovecot, postfix, spamassassin on Debian 7.5.


I want to do server-side spam filtering, so I've got spamasassin
identifying spam, and then have sieve sorting the mail to a special spam
folder.   I can easily send spam to special folder in the inbox for each
mail user, but I wanted to have a single mail account for spam.   I can use
the "redirect" sieve command to send anything with the X-spam-flag set, but
this triggers an error and bounces the offending mail.   The bounce message
is:


From: MAILER-DAEMON at NerdWorld.org (Mail Delivery System)
To: casey at vmailservertest.nerdworld.org
Subject: Undelivered Mail Returned to Sender
Date: Sun, 19 Oct 2014 16:41:49 -0400 (EDT)

This is the mail system at host VMailServerTest.NerdWorld.org.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                   The mail system

<spam at vmailservertest.nerdworld.org>: mail forwarding loop for
    spam at vmailservertest.nerdworld.org

From: casey at vmailservertest.nerdworld.org
Date: Sun, 19 Oct 2014 16:41:20 -0400 (EDT)

viagra!!!!
www.viagra.com




I think this is a recursion problem, since the redirected mail has to go
through the spamassassin check and sieve again.   I tried to get clever and
prevent the recursion, but I'm not clever enough.  Here is my sieve rule
file.

#
#
# A rule to move spam to the spam user
#  based on spamassassin setting the spam flag
#
#
# require ["redirect"]; (Not needed, since it is part of the basis sieve
spec)
#
# rule:[SPAM]
if header :contains "X-Spam-Flag" ["YES"]
        {
        if address :is "to" "Spam at VMailServerTest.NerdWorld.org" 
                {
                keep;
                }
        else
                {
                redirect "spam at VMailServerTest.NerdWorld.org";
                }
        }
#
#
#

Anybody able to give me any advice?  TIA


-- 

Casey Bralla

Chief Nerd in Residence
The NerdWorld Organisation

www.NerdWorld.org


More information about the dovecot mailing list