RainLoop / rainloop-webmail

Simple, modern & fast web-based email client
http://rainloop.net
MIT License
4.1k stars 883 forks source link

Convert Sieve filter from SquirrelMail #1784

Open achekalin opened 5 years ago

achekalin commented 5 years ago

RainLoop version 1.12.1, Dovecot 2.0.9, OS: CentOS 7.5

As we tried to move out of old SquirrelMail webmail, I find we can not edit Sieve filters that was made in SquirrelMail. The IMAP server is dovecot, storage is Maildir, and what I can see, RainLoop can not see or edit SquirrelMail's filters (and vise versa).

First of all, it uses different files to store filters: phpscript.sieve vs rainloop.user.sieve. They are slightly different from each other, like this:

SquirrelMail's phpscript.sieve:

# This script has been automatically generated by avelsieve
# (Sieve Mail Filters Plugin for Squirrelmail)
# Warning: If you edit this manually, then the changes will not 
# be reflected in the users' front-end!
#AVELSIEVE_VERSIONYTo0OntzOjU6Im1ham9yIjtpOjE7czo1OiJtaW5vciI7aTo5O3M6NzoicmVsZWFzZSI7aTo5O3M6Njoic3RyaW5nIjtzOjU6IjEuOS45Ijt9
#AVELSIEVE_CREATED1514299391
#AVELSIEVE_MODIFIED1514299391

require ["fileinto","imap4flags","vacation"];
# rule:[zabbix@domain.com]
if allof (address :contains "from" zabbix@domain.com", header :contains "to" "me@domain.com")
{
        fileinto "FromZabbix";
        stop;
}

while

RainLoop's rainloop.user.sieve:

require ["fileinto"];

# This is RainLoop Webmail sieve script.
# Please don't change anything here.
# RAINLOOP:SIEVE

/*
BEGIN:FILTER:m14pi10vp1rgy6boe29noyxv853t1bh4
BEGIN:HEADER
eyJJRCI6Im0xNHBpMTB2cDFyZ3k2Ym9lMjlub3l4djg1M3QxYmg0IiwiRW5hYmxlZCI6dHJ1ZS
wiTmFtZSI6IjExMSIsIkNvbmRpdGlvbnMiOlt7IkZpZWxkIjoiRnJvbSIsIlR5cGUiOiJDb250
YWlucyIsIlZhbHVlIjoiMTExIiwiVmFsdWVTZWNvbmQiOiIifV0sIkNvbmRpdGlvbnNUeXBlIj
oiQW55IiwiQWN0aW9uVHlwZSI6Ik1vdmVUbyIsIkFjdGlvblZhbHVlIjoiRnJvbVphYmJpeCIs
IkFjdGlvblZhbHVlU2Vjb25kIjoiIiwiQWN0aW9uVmFsdWVUaGlyZCI6IiIsIkFjdGlvblZhbH
VlRm91cnRoIjoiIiwiS2VlcCI6dHJ1ZSwiU3RvcCI6dHJ1ZSwiTWFya0FzUmVhZCI6ZmFsc2V9
END:HEADER
*/

if header :contains ["From"] "zabbix@domain.com"
{
    fileinto "FromZabbix";
    stop;
}

/* END:FILTER */

I'd be more that happy if I can set it up to use the same file and same format, but even if it is not possible, I want to do once-only SquirrelMail -> RainLoop filter formats, so I can convert it and use RainLoop further.

Thank you!

ervee commented 5 years ago

This problem has been reported before and while it is inconvenient, the (manage)sieve implementation is IMHO at fault here. As far as I know RainLoop cannot "read" the current rules set by another webmail because there is no way of reading it via managesieve.

And while you now have phpscript.sieve and rainloop.user.sieve there is only one of those active in ~/.dovecot.sieve or whatever file you configured in Dovecot.

For my site I instructed all users to migrate their old settings to the new where applicable. Sad but true.