Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:nomagic:client_software:thunderbird:sieve [2021/11/10 17:48] hostmasteren:nomagic:client_software:thunderbird:sieve [2021/11/12 23:35] (current) – [Configuration] hostmaster
Line 1: Line 1:
 ====== Sieve management in Thunderbird ====== ====== Sieve management in Thunderbird ======
  
-<WRAP center round important 95%> +<WRAP center round important 65%> 
-Sieve management in Thunderbird requires to know about the Sieve syntax in order to create your rules. +Sieve management in Thunderbird requires to know (or be willing to learn) about the Sieve syntax in order to create your rules. 
  
 It's up to you really, but know that this is the **harder** way, and that easy mail filter management can be achieved from within our Sogo Groupware. It's also the recommended method ([[en:nomagic:mail:sieve|see documentation here]]). It's up to you really, but know that this is the **harder** way, and that easy mail filter management can be achieved from within our Sogo Groupware. It's also the recommended method ([[en:nomagic:mail:sieve|see documentation here]]).
Line 33: Line 33:
  
 <WRAP center round info 95%> <WRAP center round info 95%>
-If it's your first script, you <del>must fight</del> should follow the guides which will as you to name your new script. +If it's your first script, you <del>must fight</del> should follow the guides which will ask you to name your new script. 
 </WRAP> </WRAP>
  
Line 40: Line 40:
 {{:en:nomagic:client_software:thunderbird:sieve04.png?nolink|}} {{:en:nomagic:client_software:thunderbird:sieve04.png?nolink|}}
  
 +===== Management =====
  
 +You are now where the magic happens. You have all the flexibility of Sieve at your fingertips.
  
-{{en:nomagic:client_software:thunderbird:sieve4.png?direct&600|}} \\+I personally use the //raw script// view to set up my filters, which looks like this:
  
 +{{:en:nomagic:client_software:thunderbird:sieve05.png?nolink|}}
  
-All done! The Sieve plugin comes with documentation included on the right side of the screen.+But you can also test / use the **Script** tab, which is useful to refer to also when you are looking for a specific Sieve keyword: 
 + 
 +{{:en:nomagic:client_software:thunderbird:sieve06.png?nolink|}}
  
 <WRAP center round tip 95%> <WRAP center round tip 95%>
 To be able to use the different  //actions//, you need to import them first at the top of the file using **require**. You can do that as needs come, or put a quite general line like this: To be able to use the different  //actions//, you need to import them first at the top of the file using **require**. You can do that as needs come, or put a quite general line like this:
 <code> <code>
-require ["imap4flags","envelope","subaddress","fileinto","variables","vacation","reject"];+require ["imap4flags","envelope","subaddress","fileinto","variables","vacation","reject","copy","mailbox"];
 </code> </code>
 </WRAP> </WRAP>
Line 57: Line 62:
  
 ==== Example ==== ==== Example ====
-In this first example we are setting up a 'flag' rule, marking any email coming from //management@nomagic.uk// as important, based on the Thunderbird flag colour numbers.+In this example we are setting up a 'flag' rule, marking any email coming from //management@nomagic.uk// as important, based on the Thunderbird and/or Sogo flag colour numbers.
  
-  * We identify flag ''Important'' as number 1 from Thunderbird's preferences+  * We identify flag ''Important'' as ''$label 1'' from Thunderbird's preferences
  
 {{en:nomagic:client_software:thunderbird:sieve5.png?direct&600|}} {{en:nomagic:client_software:thunderbird:sieve5.png?direct&600|}}
Line 68: Line 73:
 Sieve plugin automatically checks for syntax error, which makes it very handy when you add / modify rules Sieve plugin automatically checks for syntax error, which makes it very handy when you add / modify rules
 </WRAP> </WRAP>
 +
 <WRAP center round tip 95%> <WRAP center round tip 95%>
 It is strongly advised to keep a commented label of each of your rules, as shown on the screenshot, with the format: It is strongly advised to keep a commented label of each of your rules, as shown on the screenshot, with the format:
Line 73: Line 79:
 </WRAP> </WRAP>
  
-{{en:nomagic:client_software:thunderbird:sieve6.png?direct&600|}\\+<code> 
 +
 +# Mail filters (server-side) 
 +
 +require ["imap4flags","envelope"]; 
 + 
 +if address :is :all "from" "management@nomagic.uk" { 
 + addflag "$label1"; 
 +} 
 +</code>
  
 That's it, all emails from NOMAGIC's management will be marked with the important flag as they arrive in your mailbox! That's it, all emails from NOMAGIC's management will be marked with the important flag as they arrive in your mailbox!
 </WRAP> </WRAP>
  
-===== Troubleshooting ===== +<WRAP center round tip 95%> 
-===== Authentication ===== +Filters are tested in the order that they appear in the file. If you want to avoid getting through all of them as you don't plan on having 2 filters applied to the same emaildeclare your filters in a series of ''if { .elsif { .. } elsif { .. }''. That way the Sieve server will stop on the first match.
-A vulnerability fix deployed by package manager on the 01/03/2018 resulted in the new requirement: +
-  * authentication mechanism needs to be set from client (as opposed to guessed during connection) +
-If the sieve plugin is not set properly to **Plain** authenticationyou will get the following error: +
-{{en:nomagic:client_software:thunderbird:sieve_auth.png?direct&600|} \\ +
-Click on **Settings...** button, then select **Change Settings** and use the drop-down menu to select ''Plain'' from the **Security** tab+
  
 +<WRAP center round box 95%>
 +=== Example ===
  
-^ Main access | https://Sieve.nomagic.uk | +<code> 
-^ Aliases | https:// +if address :is :all "from" "management@nomagic.uk" { 
 + addflag "$label1"; 
 +
 +# rule:[aide] 
 +elsif envelope :detail "to" "aide" 
 +
 + fileinto "INBOX.dev.aide"; 
 +
 +# rule:[postfix] 
 +elsif anyof (address :is "to" "postfix-users@postfix.org", address :is "cc" "postfix-users@postfix.org"
 +
 + fileinto "INBOX.postfix"; 
 +
 +</code> 
 +</WRAP>
  
-===== Description =====+</WRAP>
  
-===== Official documentation ===== +==== Vacation management ==== 
-^ Project | | +Vacation is plain Sieve syntax, using the right requirements you can set up vacation via your Sieve script.
-^ Documentation | |+
  
-===== Nomagic documentation =====+I would suggest several ways to do that though. 
  
-===== FAQ =====+  * Manual activation / deactivation  
 +<code> 
 +require ["fileinto","envelope","subaddress","vacation", "reject"]; 
 + 
 +# rule:[vacation] 
 +if false # change to true and Save to activate the auto-reply. 
 +
 + vacation :days 1 :addresses "tux@nomagic.uk" :subject "out of office: auto reply" text: 
 +I am currently away from keyboard for some days. 
 +I will reply when I get back. 
 + 
 +  Cheers, 
 + 
 +Tux 
 +
 +
 +
 +</code> 
 + 
 +  * Automatic activation / deactivation of the auto-reply 
 + 
 +<code> 
 +require ["fileinto", "imap4flags", "mailbox", "copy", "body", "date", "vacation", "relational"]; 
 + 
 +# Vacation, update the date whenever needed 
 +if allof ( not exists ["list-help", "list-unsubscribe", "list-subscribe", "list-owner", "list-post", "list-archive", "list-id", "Mailing-List"], not header :comparator "i;ascii-casemap" :is "Precedence" ["list", "bulk", "junk"], not header :comparator "i;ascii-casemap" :matches "To" "Multiple recipients of*", currentdate :value "ge" "date" "2021-11-10", currentdate :value "le" "date" "2021-11-17" ) { 
 +  vacation :days 2 :addresses ["testing@nomagic.uk", "tux@nomagic.uk"] text: 
 +Hello, 
 +I am currently away from keyboard for some days. 
 +I will reply when I get back. 
 + 
 +  Cheers, 
 + 
 +Tux 
 +
 +
 +
 +</code> 
 +→ ''days 2'' here means that, for a single email address sending us several emails over the days, an auto-reply email should be sent only every 2 days. 
 +===== Troubleshooting =====
  
 +The Sieve Thunderbird extension comes with automatic syntax check, and will prevent you from saving until your file is 'clean'. Thus, troubleshooting is made fairly easy.
  
 +===== Additional resources =====
  
 +  * http://sieve.info/