User Tools

Site Tools


doc:appunti:linux:sa:sieve_filtering_examples

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
doc:appunti:linux:sa:sieve_filtering_examples [2023/03/24 10:03] – [Pipe a message to an external program] niccolodoc:appunti:linux:sa:sieve_filtering_examples [2023/03/24 11:59] (current) – [Filtering with Sieve] niccolo
Line 1: Line 1:
 ====== Filtering with Sieve ====== ====== Filtering with Sieve ======
 +
 +The **Debian 11 Bullseye** GNU/Linux installs the **Dovecot** mail suite version **2.3.13**, including the **Pigeonhole Sieve** extension **v0.5.13** (via the **dovecot-sieve** package).
 +
 +The [[https://doc.dovecot.org/configuration_manual/sieve/pigeonhole_sieve_interpreter/|Pigeonhole Sieve Interpreter]] provides the //pipe//, //filter// and //execute// commands, where the //pipe// was the older one implemented (starting from v0.2). Currently the more modern //execute// command can be used instead of the //pipe// one.
 +
 +The following recipes were tested into a **$HOME/.dovecot.sieve** file, i.e. the users's Sieve filter applied by the Dovecot Local Delivery Agent.
 +
 +FIXME Document the timeout options.
  
 ===== Sender ===== ===== Sender =====
  
-Storing in different folder upon (envelope) sender:+Storing messages in different folder upon (envelope) sender:
  
 <code> <code>
Line 14: Line 22:
 ===== Recipient ===== ===== Recipient =====
  
-Storing in different folder upon destination address:+Storing messages in different folder upon destination address:
  
 <code> <code>
Line 56: Line 64:
 ===== Pipe a message to an external program ===== ===== Pipe a message to an external program =====
  
-To enable the **execute** command you have to add it to the **sieve_extension** editing the file **/etc/dovecot/conf.d/90-sieve.conf**. In this example both the //filter// and //execute// extensions are loaded:+To enable the **execute** Sieve command using **Debian 11** you have to edit some configuration files contained into the **/etc/dovecot/conf.d/** directory. Set the **sieve_extension** option editing the file **90-sieve.conf**; in this example both the //filter// and //execute// extensions are loaded:
  
 <file> <file>
Line 66: Line 74:
 </file> </file>
  
-Then you have to edit the **/etc/dovecot/conf.d/90-sieve-extprograms.conf** configuration file and define the **sieve_execute_socket_dir** and **sieve_execute_bin_dir** options:+Then you have to edit the **90-sieve-extprograms.conf** configuration file and define the **sieve_execute_socket_dir** and **sieve_execute_bin_dir** options:
  
 <file> <file>
Line 77: Line 85:
 </file> </file>
  
-Only the executable files contained into //sieve_execute_bin_dir// can be used as //execute// commands in sieve scripts.+Only the executables contained into //sieve_execute_bin_dir// can be used as //execute// commands in sieve scripts. 
 + 
 +The following example is used to pipe a received message to an external program, which acts as a gateway from the mail system to the SMS mobile network. Only messages originating from some addresses and containing a properly formatted subject are piped to the external program:
  
 <code> <code>
Line 91: Line 101:
 </code> </code>
  
-The **execute** command is not considered a final action (which "consumes" the message), so the **keep** action is eventually taken.+Here the **execute** //command// is called with the **:pipe** //tag//, this causes the execution of the external program much like the older ''pipe'' command. 
 + 
 +The **execute** command is not considered a final action (which "consumes" the message), so the **keep** action is eventually taken, saving the message into the INBOX.
  
   * **[[https://doc.dovecot.org/configuration_manual/sieve/plugins/extprograms/|Pigeonhole Sieve: Extprograms Plugin]]**   * **[[https://doc.dovecot.org/configuration_manual/sieve/plugins/extprograms/|Pigeonhole Sieve: Extprograms Plugin]]**
   * **[[https://mailutils.org/manual/html_chapter/Sieve-Language.html|GNU Mailutils Sieve]]**   * **[[https://mailutils.org/manual/html_chapter/Sieve-Language.html|GNU Mailutils Sieve]]**
  
doc/appunti/linux/sa/sieve_filtering_examples.1679652201.txt.gz · Last modified: 2023/03/24 10:03 by niccolo