Adi Pircalabu
2018-May-07 02:13 UTC
[sieve][regex] Matching multiple strings in the "Received" header
Hi,
I'm trying to use this expression in Sieve, but for some reason the
filter doesn't work:
require ["fileinto","regex"];
# rule:[gmail-outlook-yahoo-aol-friends]
if header :regex "received"
".from.*(outbound.protection.outlook.com|.google.com|.yahoo.com|mx.aol.com)."
{
fileinto "INBOX.gmail-hotmail-yahoo-aol-friends";
stop;
}
However, it's working fine with egrep:
egrep
".from.*(outbound.protection.outlook.com|.google.com|.yahoo.com|mx.aol.com)."
*
1525657297.M401428P1459.host01.quick.net.au,S=10073,W=10275:2,S:Received:
from APC01-PU1-obe.outbound.protection.outlook.com
(mail-oln040092254061.outbound.protection.outlook.com [40.92.254.61])
Am I using Sieve correctly here? Is
".from.*(outbound.protection.outlook.com|.google.com|.yahoo.com|mx.aol.com)."
expression valid for Sieve? Or do I have to split it in an array as per
https://wiki2.dovecot.org/Pigeonhole/Sieve/Examples#Flagging_or_Highlighting_your_mail
example?
Thanks,
--
Adi Pircalabu
Adi Pircalabu
2018-May-07 03:10 UTC
[sieve][regex] Matching multiple strings in the "Received" header
On 07-05-2018 12:13, Adi Pircalabu wrote:> > I'm trying to use this expression in Sieve, but for some reason the > filter doesn't work: > > require ["fileinto","regex"]; > > # rule:[gmail-outlook-yahoo-aol-friends] > if header :regex "received" > ".from.*(outbound.protection.outlook.com|.google.com|.yahoo.com|mx.aol.com)." > { > fileinto "INBOX.gmail-hotmail-yahoo-aol-friends"; > stop; > }Update: this works: if header :regex "received" "from.*(outbound.protection.outlook.com|.google.com|.yahoo.com|mx.aol.com)" { fileinto "INBOX.gmail-hotmail-yahoo-aol-friends"; stop; } How should I write it to also match the space character at both the beginning and end of the expression? --- Adi Pircalabu
Reasonably Related Threads
- [sieve][regex] Matching multiple strings in the "Received" header
- [sieve][regex] Matching multiple strings in the "Received" header
- [sieve][regex] Matching multiple strings in the "Received" header
- [sieve][regex] Matching multiple strings in the "Received" header
- [sieve][regex] Matching multiple strings in the "Received" header