[Dovecot] Namespace with a single mailbox (for spam)
Hi there.
Perhaps this is answered somewhere, but a short search through the mailing list and Wiki yielded nothing.
We have spam filtering set up for all users, with all messages over some spam threshold going to a separate mbox. There is one directory containing the spam mboxes of all users (call it "/var/spool/spam", right now), with the spam box of a user residing in /var/spool/spam/<user>.
I am trying to achieve that, in IMAP, each user will see his spam mbox as a folder named "SPAM" or something like that (possibly under some new namespace), without creating a symbolic link for each user.
Is there any facility for that?
Specifically, I do not want to create a single namespace pointing to the directory, since that will cause each user to have to access his spam folder under a different name (e.g. #spam.<user>), and users will also see (although not be able to read) others' spam folders.
Regards, -- Tom
-- Tom Alsberg - hacker (being the best description fitting this space) Web page: http://www.cs.huji.ac.il/~alsbergt/ DISCLAIMER: The above message does not even necessarily represent what my fingers have typed on the keyboard, save anything further.
/var/spool/spam/<user>.
I am trying to achieve that, in IMAP, each user will see his spam mbox as a folder named "SPAM" or something like that (possibly under some new namespace), without creating a symbolic link for each user.
Is there any facility for that?
Looking at http://wiki.dovecot.org/Namespaces
w/o doing any testing, I would try something along these lines (from the bottom of the page)
namespace private { separator = / inbox = yes location = mbox:/var/spool/spam/%u:INBOX=/var/spool/%u }
Thank you for the answer. However this would not work, as a namespace has to be a directory. What I want is either a "custom" namespace that doesn't directly map to a directory, so it will contain only one mailbox.
Or perhaps a namespace can contain messages directly? However the syntax given doesn't work with Dovecot (I tried).
What would be probably best for me is something like the INBOX=, for mapping arbitrary folder names to arbitrary mailboxes, on top of the automatic directory mapping.
-- Tom
On Mon, Sep 11, 2006 at 10:58:04AM -0400, Jim Horner wrote:
Looking at http://wiki.dovecot.org/Namespaces
w/o doing any testing, I would try something along these lines (from the bottom of the page)
namespace private { separator = / inbox = yes location = mbox:/var/spool/spam/%u:INBOX=/var/spool/%u }
-- Tom Alsberg - hacker (being the best description fitting this space) Web page: http://www.cs.huji.ac.il/~alsbergt/ DISCLAIMER: The above message does not even necessarily represent what my fingers have typed on the keyboard, save anything further.
On Tuesday 12 September 2006 02:09, Tom Alsberg wrote:
Thank you for the answer. However this would not work, as a namespace has to be a directory. What I want is either a "custom" namespace that doesn't directly map to a directory, so it will contain only one mailbox.
... possibly setting up a shared namespace, like
namespace public {
separator = .
prefix = spam.
location=mbox:/var/spool/spam:
CONTROL=/var/mail/%u/shared-settings/support/control:
INDEX=/var/mail/%u/shared-settings/support/index
}
then using ACL plugin
protocol imap { .. mail_plugins = acl } ... plugin { acl = vfile:/etc/dovecot-acls }
and creating a bunch of acl files for each user, so you'd have
/etc/dovecot-acls/user1 file containing just one line user=user1 rlrwstiekxa
This is just an idea... looks like a lot of work. In any event, I think using ACLs this way would eliminate users seeing all the spam mailboxes.
Jim
----- Original Message ----- From: "Tom Alsberg" alsbergt@cs.huji.ac.il
Hi there.
Perhaps this is answered somewhere, but a short search through the mailing list and Wiki yielded nothing.
We have spam filtering set up for all users, with all messages over some spam threshold going to a separate mbox. There is one directory containing the spam mboxes of all users (call it "/var/spool/spam", right now), with the spam box of a user residing in /var/spool/spam/<user>.
I am trying to achieve that, in IMAP, each user will see his spam mbox as a folder named "SPAM" or something like that (possibly under some new namespace), without creating a symbolic link for each user.
Is there any facility for that?
Specifically, I do not want to create a single namespace pointing to the directory, since that will cause each user to have to access his spam folder under a different name (e.g. #spam.<user>), and users will also see (although not be able to read) others' spam folders.
Tom, are you using a sieve or delivery agent (procmail/maildrop) to handle
final delivery to the IMAP folders based on the spam threshold? If so, we
use maildrop and include the following in our "/etc/maildroprc" config file"
#==========
# Deliver to Inbox or Spam box
if (/^X-Spam-Flag: YES/)
{
test -d $DEFAULT/.Spam
if( $RETURNCODE == 1 )
{
/usr/local/bin/maildirmake -f Spam $DEFAULT
echo "Spam" >> $DEFAULT/subscriptions
}
exception {
to "$DEFAULT/.Spam"
}
# if all else fails, do regular delivery
exception {
to "$DEFAULT"
}
}
#==========
For us, this basically checks to see if the Spamassassin spam flag (X-Spam-Flag: YES) is found in the message headers, and if so, checks to see if the recipient has a "Spam" folder already defined, and if not, creates it and then delivers the message into the spam folder and adds "Spam" to the IMAP "subscriptions" files. If anything fails along the way, it will instead send the message to the default inbox folder.
HTH,
Bill
On Mon, Sep 11, 2006 at 10:11:11AM -0700, Bill Landry wrote:
Tom, are you using a sieve or delivery agent (procmail/maildrop) to handle final delivery to the IMAP folders based on the spam threshold?
Well, we do have some complex delivery process (using Exim filters and several custom scripts) to get the messages to the spam box.
If so, we use maildrop and include the following in our
However, it is not feasible right now to adjust the delivery process to create the links. The requirement is that the MTA knows nothing about the existence of an IMAP server, and except for delivering the mail in some preset/known locations, the IMAP server cannot expect more from the MTA.
That's why I'm looking for something transparent to the MTA and system
just some mapping on the IMAP server's side.
Thanks anyway, regards, -- Tom
-- Tom Alsberg - hacker (being the best description fitting this space) Web page: http://www.cs.huji.ac.il/~alsbergt/ DISCLAIMER: The above message does not even necessarily represent what my fingers have typed on the keyboard, save anything further.
participants (3)
-
Bill Landry
-
Jim Horner
-
Tom Alsberg