doc:appunti:linux:sa:sieve_filtering_examples
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
doc:appunti:linux:sa:sieve_filtering_examples [2023/03/22 22:25] – [Forward with From rewrite (to pass SPF check)] niccolo | doc: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:// | ||
+ | |||
+ | The following recipes were tested into a **$HOME/ | ||
+ | |||
+ | FIXME Document the timeout options. | ||
===== Sender ===== | ===== Sender ===== | ||
- | Storing in different folder upon (envelope) sender: | + | Storing |
< | < | ||
Line 14: | Line 22: | ||
===== Recipient ===== | ===== Recipient ===== | ||
- | Storing in different folder upon destination address: | + | Storing |
< | < | ||
Line 25: | Line 33: | ||
===== Forward and keep a local copy ===== | ===== Forward and keep a local copy ===== | ||
- | The **redirect** built-in //action// can be modified by the **:copy** //tag// (which is a built-in extension, but it must enabled using the **require** statement). The '': | + | The **redirect** built-in //action// can be modified by the **:copy** //tag// (which is a built-in extension, but it must enabled using the **require** statement). The '': |
< | < | ||
Line 56: | Line 64: | ||
===== Pipe a message to an external program ===== | ===== Pipe a message to an external program ===== | ||
- | < | + | 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: |
- | require [" | + | |
+ | < | ||
+ | plugin { | ||
+ | ... | ||
+ | | ||
+ | ... | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | 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: | ||
+ | |||
+ | < | ||
+ | plugin { | ||
+ | ... | ||
+ | sieve_execute_socket_dir = sieve-execute | ||
+ | sieve_execute_bin_dir = / | ||
+ | ... | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Only the executables contained into // | ||
+ | |||
+ | 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: | ||
+ | |||
+ | < | ||
+ | require [" | ||
# Specially crafted messages are piped to an SMS gateway. | # Specially crafted messages are piped to an SMS gateway. | ||
if allof ( | if allof ( | ||
Line 69: | Line 101: | ||
</ | </ | ||
- | The **execute** command is not considered a final action (which " | + | Here the **execute** //command// is called with the **:pipe** //tag//, this causes the execution of the external program much like the older '' |
+ | |||
+ | The **execute** command is not considered a final action (which " | ||
* **[[https:// | * **[[https:// | ||
* **[[https:// | * **[[https:// | ||
doc/appunti/linux/sa/sieve_filtering_examples.1679523902.txt.gz · Last modified: 2023/03/22 22:25 by niccolo