[Dovecot] Automatically subscribe to folder?
Hello everybody,
i am filtering e-mails using the cmusieve-plugin. A global script filters all mails tagged by SpamAssasin and moves them into the folder Spam:
if header :is "X-Spam-Flag" "YES" { fileinto "Spam"; }
My problem is that users who did not had a folder Spam until the first time of filtering a spam mail are not automatically subscribed to this new created folder. They have to do this step manually in their mail client.
Is it possible to automate this script and subscribe the account to this folder when it is created by the sieve script?
Regards, Christian
On 25.12.2007 23:36, Christian Flothmann wrote:
Hello everybody,
i am filtering e-mails using the cmusieve-plugin. A global script filters all mails tagged by SpamAssasin and moves them into the folder Spam:
if header :is "X-Spam-Flag" "YES" { fileinto "Spam"; }
My problem is that users who did not had a folder Spam until the first time of filtering a spam mail are not automatically subscribed to this new created folder. They have to do this step manually in their mail client.
Is it possible to automate this script and subscribe the account to this folder when it is created by the sieve script?
Regards, Christian
You probably can write you own shell script to add folder name in subscription file, because its stored as text.
On 04.01.2008 0:48, Christian Flothmann wrote:
You probably can write you own shell script to add folder name in subscription file, because its stored as text.
Thanks, I think I will write a shell script which runs periodically and add the folder name to the subscription file.
I forgot to add some MUA don't like be subscribed to folders which doesn't exist so you should probably aware of this too in case such MUA used in your environment .
I forgot to add some MUA don't like be subscribed to folders which doesn't exist so you should probably aware of this too in case such MUA used in your environment .
Do you have a list of these MUA or do you know if there is a possibility to detect wether the folder exists or not?
On 04.01.2008 0:59, Christian Flothmann wrote:
I forgot to add some MUA don't like be subscribed to folders which doesn't exist so you should probably aware of this too in case such MUA used in your environment .
Do you have a list of these MUA or do you know if there is a possibility to detect wether the folder exists or not?
Well I never pay attention to this because never need such functionality. You can include checks for existing folder in shell script, after creating empty folder Dovecot just generate index next time user try to open it.
"NS" == Nikolay Shopik shopik@inblock.ru writes:
NS> I forgot to add some MUA don't like be subscribed to folders which
NS> doesn't exist so you should probably aware of this too in case
NS> such MUA used in your environment .
While it doesn't surprise me that there may well be MUAs which don't like subcriptions to folders that don't exist it seems to me that such MUAs are sailing pretty close to the wind as regards RFC 3501.
The wording of sections 6.3.6 and 6.3.9 as I read it pretty heavily imply that clients must be prepared to deal with subscribed folders that no longer exist because a server is explicitly prevented from attempting to 'protect' a client from such a situation.
6.3.6. SUBSCRIBE Command
[...]
A server MAY validate the mailbox argument to SUBSCRIBE to verify
that it exists. However, it MUST NOT unilaterally remove an
existing mailbox name from the subscription list even if a mailbox
by that name no longer exists.
Note: This requirement is because a server site can
choose to routinely remove a mailbox with a well-known
name (e.g., "system-alerts") after its contents expire,
with the intention of recreating it when new contents
are appropriate.
[...]
6.3.9. LSUB Command
[...]
The server MUST NOT unilaterally remove an existing mailbox name
from the subscription list even if a mailbox by that name no
longer exists.
Here is my litte script:
#!/bin/bash
# find all domains for domain in /var/mail/*; do if [ -d $domain ]; then # find all accounts for each domain for user in $domain/*; do if [ -d $user ]; then subscriptionfile=$user/mail/subscriptions
# create subscription file if it does not exist
if [ ! -f $subscriptionfile ]; then
touch $subscriptionfile
fi
grep Spam $user/mail/subscriptions &> /dev/null
# subscribe to folder if user has not been subscribed yet
if [ $? -eq 1 ]; then
echo "Spam" >> $subscriptionfile
fi;
fi
done
fi
done
Maybe this could help someone having the same problem.
This is entirely client independent. Some clients would see this
automatically while others such as outlook will not. As far as I am
aware there is no way to push this from server side.
Mark.
On 25 Dec 2007, at 20:36, "Christian Flothmann" wrote: Hello everybody, i am filtering e-mails using the cmusieve-plugin. A global script if header :is "X-Spam-Flag" "YES" {
fileinto "Spam";
} My problem is that users who did not had a folder Spam until the first
time of filtering a spam mail are not automatically subscribed to Is it possible to automate this script and subscribe the account to Regards,
Christian
filters
all mails tagged by SpamAssasin and moves them into the folder Spam:
this new
created folder. They have to do this step manually in their mail
client.
this
folder when it is created by the sieve script?
On 27.12.2007 20:33, Mark Adams wrote:
This is entirely client independent. Some clients would see this automatically while others such as outlook will not. As far as I am aware there is no way to push this from server side.
Mark.
On 25 Dec 2007, at 20:36, "Christian Flothmann" christian.flothmann@xabbuh.de wrote:
Hello everybody,
i am filtering e-mails using the cmusieve-plugin. A global script filters all mails tagged by SpamAssasin and moves them into the folder Spam:
if header :is "X-Spam-Flag" "YES" { fileinto "Spam"; }
My problem is that users who did not had a folder Spam until the first time of filtering a spam mail are not automatically subscribed to this new created folder. They have to do this step manually in their mail client.
Is it possible to automate this script and subscribe the account to this folder when it is created by the sieve script?
Regards, Christian
You mean outlook even don't check on startup on which folders it subscribed?
You mean outlook even don't check on startup on which folders it subscribed? As far as I can see on my network, Thunderbird 2.x and Outlook Express 6.x and 7.x both show IMAP folders according to the Dovecot "subscriptions" file, with no further user intervention needed.
Outlook may be different.
John Allen
Yes in 2003 this is what I have experienced with outlook. Outlook
express has actualy quite good IMAP support.
If I'm wrong about 2003 I would like to know where I was going wrong!
Mark.
On 27 Dec 2007, at 18:13, John and Catherine Allen allen@vo.lu wrote:
You mean outlook even don't check on startup on which folders it
subscribed? As far as I can see on my network, Thunderbird 2.x and Outlook
Express 6.x and 7.x both show IMAP folders according to the Dovecot
"subscriptions" file, with no further user intervention needed.Outlook may be different.
John Allen
On 12/27/2007, Mark Adams (mark@campbell-lange.net) wrote:
Outlook express has actualy quite good IMAP support.
I wouldn't go quite that far, but it is definitely better than Outlook.
Thunderbird support is excellent for the most part, but it has some quirks too...
For mobile applications, the iPhone has very good IMAP support - best I've seen on a phone. Works as well as TBird.
--
Best regards,
Charles
On 25 Dec 2007, at 20:36, "Christian Flothmann" Is it possible to automate this script and subscribe the account to
this folder when it is created by the sieve script? You could create a script that create/subscribed users to various
key/important folders and execute this if you periodically roll
through imap directories (i do this for spam false positives and what
not for example and make sure people are subscribed and don't delete
their SPAM folders --- sigh) or you could create a wrapper that did
this individually when the various imap process is invoked (like the
many wiki examples have). Personally I would look to patching sieve which is of course insecure
and against their philosophy, but not any worse than doing the above
or using procmail. --
Gabriel Millerd
participants (7)
-
Charles Marcus
-
Christian Flothmann
-
Gabriel Millerd
-
John and Catherine Allen
-
Mark Adams
-
Nikolay Shopik
-
pod