The Sieve script example (Complex filtering with variables) can be improved.
As it stands, depending on the From header, the result may not be what was intended.
Current example:
require ["variables", "fileinto", "regex"];
if header :regex "From" "(.+)@example\\.com" {
set :lower "sender" "${1}";
fileinto "Contacts/${sender}";
}
From: "John Doe" <john.doe@example.com>
filing message into 'Contacts/"john doe" <john.doe'
Suggestion:
require ["variables", "fileinto", "regex"];
if address :all :regex "From" "(.+)@example\\.com$" {
set :lower "sender" "${1}";
fileinto "Contacts/${sender}";
}
From: "John Doe" <john.doe@example.com>
filing message into 'Contacts/john.doe'
Using regex here might be overkill; matches could be more appropriate (although regex still works well as an example).
require ["variables", "fileinto", "mailbox"];
if address :all :matches "From" "*@example.com" {
set :lower :upperfirst "sender" "${1}";
fileinto :create "Contacts/${sender}";
}
From: "John Doe" <john.doe@example.com>
filing message into 'Contacts/John.doe'
The Sieve script example (Complex filtering with variables) can be improved.
As it stands, depending on the
Fromheader, the result may not be what was intended.Current example:
Suggestion:
Using regex here might be overkill;
matchescould be more appropriate (although regex still works well as an example).