[Dovecot] Sieve fileinto and year/month folders.
Hi there,
I am trying to move from lmtpd (lmtpd.sf.net) to dovecot sieve.
One thing used by some of powerusers are archiving mail automatically with autocreated folders based on year + month.
Is there any good way to make that with sieve...
One example
require "fileinto";
if address :is ["From", "To"] "dovecot@dovecot.org" { fileinto "INBOX.mls.%Y.%m.dovecot"; }
This will fill any mails into INBOX.mls.2012.03.dovecot uppon receiving...
I don't know if some sieve guru can tell me how to do that... ?
Kind regards,
Xavier
Op 3/28/2012 5:50 PM, Xavier Beaudouin schreef:
Hi there,
I am trying to move from lmtpd (lmtpd.sf.net) to dovecot sieve.
One thing used by some of powerusers are archiving mail automatically with autocreated folders based on year + month.
Is there any good way to make that with sieve...
One example
require "fileinto";
if address :is ["From", "To"] "dovecot@dovecot.org" { fileinto "INBOX.mls.%Y.%m.dovecot"; }
This will fill any mails into INBOX.mls.2012.03.dovecot uppon receiving...
I don't know if some sieve guru can tell me how to do that... ?
require ["variables","date","fileinto","mailbox"];
# Extract date info if currentdate :matches "year" "*" { set "year" "${1}"; } if currentdate :matches "month" "*" { set "month" "${1}"; }
# Archive Dovecot mailing list items by year and month. # Create folder when it does not exist. if header :is "list-id" "dovecot.dovecot.org" { fileinto :create "INBOX.mls.${year}.${month}.dovecot"; }
The above also uses a more reliable way to detect the Dovecot mailinglist.
Regards,
Stephan
On 2012-03-28 9:04 AM, Stephan Bosch wrote:
Op 3/28/2012 5:50 PM, Xavier Beaudouin schreef:
Hi there,
I am trying to move from lmtpd (lmtpd.sf.net) to dovecot sieve.
One thing used by some of powerusers are archiving mail automatically with autocreated folders based on year + month.
Is there any good way to make that with sieve...
One example
require "fileinto";
if address :is ["From", "To"] "dovecot@dovecot.org" { fileinto "INBOX.mls.%Y.%m.dovecot"; }
This will fill any mails into INBOX.mls.2012.03.dovecot uppon receiving...
I don't know if some sieve guru can tell me how to do that... ?
require ["variables","date","fileinto","mailbox"];
# Extract date info if currentdate :matches "year" "*" { set "year" "${1}"; } if currentdate :matches "month" "*" { set "month" "${1}"; }
# Archive Dovecot mailing list items by year and month. # Create folder when it does not exist. if header :is "list-id" "dovecot.dovecot.org" { fileinto :create "INBOX.mls.${year}.${month}.dovecot"; }
The above also uses a more reliable way to detect the Dovecot mailinglist.
Regards,
Stephan
Stephan,
Is the "mailbox" extension the one that lets "fileinto" use ":create"? I've had a hard time trying to find a useful sieve reference that I can understand.
Thank you,
-Greg
Op 3/28/2012 6:26 PM, Gregory Finch schreef:
On 2012-03-28 9:04 AM, Stephan Bosch wrote:
require ["variables","date","fileinto","mailbox"];
# Extract date info if currentdate :matches "year" "*" { set "year" "${1}"; } if currentdate :matches "month" "*" { set "month" "${1}"; }
# Archive Dovecot mailing list items by year and month. # Create folder when it does not exist. if header :is "list-id" "dovecot.dovecot.org" { fileinto :create "INBOX.mls.${year}.${month}.dovecot"; }
The above also uses a more reliable way to detect the Dovecot mailinglist.
Stephan,
Is the "mailbox" extension the one that lets "fileinto" use ":create"? I've had a hard time trying to find a useful sieve reference that I can understand.
Thank you,
Yes:
http://tools.ietf.org/html/rfc5490#section-3.2
You can find links to specifications of the various Sieve extensions implemented for Pigeonhole here:
Regards,
Stephan.
On 2012-03-28 8:50 AM, Xavier Beaudouin wrote:
Hi there,
I am trying to move from lmtpd (lmtpd.sf.net) to dovecot sieve.
One thing used by some of powerusers are archiving mail automatically with autocreated folders based on year + month.
Is there any good way to make that with sieve...
One example
require "fileinto";
if address :is ["From", "To"] "dovecot@dovecot.org" { fileinto "INBOX.mls.%Y.%m.dovecot"; }
This will fill any mails into INBOX.mls.2012.03.dovecot uppon receiving...
I don't know if some sieve guru can tell me how to do that... ?
Kind regards,
Xavier
I don't remember where I found out how to do this, but the following is what I use:
require ["fileinto", "imap4flags", "date", "variables"]; if currentdate :matches "month" "*" { set "month" "${1}"; } if currentdate :matches "year" "*" { set "year" "${1}"; } fileinto :flags "\\seen" "${year}-${month}";
Deliver/lmtp is set to allow creation of folders.
-Greg
Den 2012-03-28 17:50, Xavier Beaudouin skrev:
require "fileinto";
if address :is ["From", "To"] "dovecot@dovecot.org" { fileinto "INBOX.mls.%Y.%m.dovecot"; }
is this valid sieve ?
This will fill any mails into INBOX.mls.2012.03.dovecot uppon receiving...
not all sieve have date support, and imho no one have macro supported
I don't know if some sieve guru can tell me how to do that... ?
why not keep lmtp ? :)
participants (4)
-
Benny Pedersen
-
Gregory Finch
-
Stephan Bosch
-
Xavier Beaudouin