Casey Bralla on 19 Oct 2014 13:48:33 -0700

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] Sieve Language Question

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.

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

From: (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
Date: Sun, 19 Oct 2014 16:41:49 -0400 (EDT)

This is the mail system at host

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

<>: mail forwarding loop for

Date: Sun, 19 Oct 2014 16:41:20 -0400 (EDT)


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

# 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
# rule:[SPAM]
if header :contains "X-Spam-Flag" ["YES"]
	if address :is "to" "" 
		redirect "";

Anybody able to give me any advice?  TIA

Casey Bralla

Chief Nerd in Residence
The NerdWorld Organisation
Philadelphia Linux Users Group         --
Announcements -
General Discussion  --