Added sieve rule to change mail subject
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Sieve
|
||||
|
||||
### Sieve rule to automatically sort mails by alias
|
||||
### Rule to automatically sort mails by alias
|
||||
|
||||
This Sieve rule filters mails by the mail alias they were sent to.
|
||||
Specifically, it uses a custom suffix separated by a dot: `.([0-9a-zA-Z]*)`
|
||||
@@ -17,3 +17,23 @@ if allof (header :regex "to" "^<name>.([0-9a-zA-Z]*)@<domain.tld>$")
|
||||
stop;
|
||||
}
|
||||
```
|
||||
|
||||
### Rule to change Subject of a mail on server
|
||||
|
||||
My alma mater introduced a change that subjects of all "external" mails are prefixed with `[Extern]`.
|
||||
I don't like that so I wrote a Sieve rule to remove it. The rule relies on some functions which need to be `required`.
|
||||
|
||||
```
|
||||
require ["fileinto", "editheader", "variables", "regex"];
|
||||
|
||||
if allof (header :contains "subject" "[Extern]")
|
||||
{
|
||||
# Match the subject w/o "[Extern]"
|
||||
if header :regex "Subject" "^\\[Extern\\] (.*)$" {
|
||||
# Delete header
|
||||
deleteheader "Subject";
|
||||
# Add stripped header again
|
||||
addheader :last "Subject" "${1}";
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user