[sieve][regex] Matching multiple strings in the "Received" header

Adi Pircalabu adi at ddns.com.au
Mon May 7 05:13:01 EEST 2018


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


More information about the dovecot mailing list