Received-SPF: pass (Last token {include:spf.protection.outlook.com} (res=PASS)) client-ip=40.107.69.67; envelope-from=<JimL@n2net.com>; x-ip-name=mail-eopbgr690067.outbound.protection.outlook.com;
X-Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-eopbgr690067.outbound.protection.outlook.com [40.107.69.67])
by netwin.co.nz (SurgeMail 7.3p) with ESMTP (TLS) id 7571896-1391920
for <surgemail-list@netwin.co.nz>; Tue, 22 Jan 2019 14:25:51 +0000
X-Return-Path: JimL
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=n2net.com;
s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=cQ90+NpU5er2ujmngDU42NaaWDLDB9SIYtyaw/Lzcpo=;
b=i4VfRQKI0rznRuIIydzOYuNc3UHuk9GWgeQBZ88JcKzp2zgzcKWhDG44TD5d5kwFhddAgqLahKChdGuVUZmYZMIBaJCCq9Z+wjg8c2i3zWhwjOGeh32QbcpWe9g0sjXBA8vqtdvLTtjHP3Z0oezuKpK9iJDgCS9XldycQJxKDnA=
X-Received: from BN6PR15MB1396.namprd15.prod.outlook.com (10.172.150.21) by
BN6PR15MB1155.namprd15.prod.outlook.com (10.172.205.21) with Microsoft SMTP
Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.20.1537.26; Tue, 22 Jan 2019 14:25:49 +0000
X-Received: from BN6PR15MB1396.namprd15.prod.outlook.com
([fe80::f0cb:e00f:554e:74fe]) by BN6PR15MB1396.namprd15.prod.outlook.com
([fe80::f0cb:e00f:554e:74fe%4]) with mapi id 15.20.1537.031; Tue, 22 Jan 2019
14:25:49 +0000
From: Jim Lohiser
To: "surgemail-list@netwin.co.nz" <surgemail-list@netwin.co.nz>
Subject: RE: [SurgeMail List] mfilter replace email address
Thread-Topic: [SurgeMail List] mfilter replace email address
Thread-Index: AdSudT22WoHg+vPVSFan8r6n4vekTQAMiPUAAO1IklA=
Date: Tue, 22 Jan 2019 14:25:49 +0000
Message-ID:
<BN6PR15MB1396250BF509C7B6BA957CF794980@BN6PR15MB1396.namprd15.prod.outlook.com>
References:
<BN6PR15MB13963A42F66FB1952318D57194830@BN6PR15MB1396.namprd15.prod.outlook.com>
<f6d75884-dd2e-facb-975a-bda4bba2ba47@netwinsite.com>
In-Reply-To: <f6d75884-dd2e-facb-975a-bda4bba2ba47@netwinsite.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: spf=none (sender IP is ) smtp.mailfrom=JimL@n2net.com;
X-x-originating-ip: [207.166.192.127]
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics:
1;BN6PR15MB1155;6:upyxMEsSQHtbaNfOFLN5VsRT+kcxSbGii/cbT7vEkGQ/IVigWjWS3gP2pxcRUbUXbLgK0Uv2dCxdnvpM+RQjFiJPZk/2DE2OoCR+4z3wMQs6DQjcJZCiNJ4MPdtrW/wxeCbPBuGgIuBj8Eb6R/8bK7Bb4NDZV2JtNaGp6//EWwI+K3HQgMwXEfUPylOL67EbKTiBdE44CN0cDS3m70uRqcRQM7DAUDdtgazy9wRHVT1KJwIotYhiXTG0t8PGkT+tRmRC1U4z0f9BXAo6mJrgwwdVwUDbAsKIi4d73VV7cEtVmm9MnJAna7cX4uAE8b1hKo8S83BB23ZSJ1AE5TMScqC8+Y45sAAJJMdxlCm55RH7CSP5+sj4IAL3bFBhk/+gmJkaXGBl+bXwODLtiUfjXH1iLsO6L3gbgqN6h8vSzsKgZ2lzUliSFqfaO4L45awEIqUTF9vSd1Leoa2jbGcBfA==;5:s73Txz0ONE+8Q6y3LC90qn7+6ZSt2tQ5ZpfBmPOIOl8T3x2EF9llMijRzOdV2Zw0CA/ao8r72ihn77g/qOwjLPukEfQep2/2jyO4koUJWPEwizUY6hqkhPnFiP5cb4KV3M6kpHFVUe9BFkxAGQUVQJXn/VfR8y4NcyqBGFZUqerVb5A/RuIxuumupBOTYn16xT4MIWzQ5C938cjDls9aTA==;7:/ddPotd6ivoKxZQYc26yu7fEwZoIlCegAcuv1AEPe7w2Sd9DrRCsb332mkuUD9XP5u2tREIFJu2Y9nUkYWuv4OCh3FeFb+c1390Mpy9NTve/Y0RxZ1Oy5xPdUsBR73tm6BP+mRCUItr8ell6TJQycg==
x-ms-office365-filtering-correlation-id: e1061bb9-6944-4f6c-928c-08d680758181
x-microsoft-antispam:
BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(7021145)(8989299)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(5600109)(711020)(2017052603328)(7153060)(7193020);SRVR:BN6PR15MB1155;
x-ms-traffictypediagnostic: BN6PR15MB1155:
x-microsoft-antispam-prvs:
<BN6PR15MB11554844DD3BAC6084BB538394980@BN6PR15MB1155.namprd15.prod.outlook.com>
x-forefront-prvs: 0925081676
x-forefront-antispam-report:
SFV:NSPM;SFS:(10009020)(39830400003)(376002)(396003)(366004)(346002)(136003)(199004)(189003)(51874003)(13464003)(476003)(5640700003)(9686003)(2906002)(229853002)(256004)(446003)(11346002)(6436002)(55016002)(26005)(6506007)(102836004)(53546011)(186003)(86362001)(7696005)(76176011)(486006)(3846002)(72206003)(14454004)(508600001)(6246003)(53936002)(6116002)(97736004)(71200400001)(71190400001)(80792005)(8936002)(6916009)(81156014)(81166006)(33656002)(8676002)(305945005)(25786009)(105586002)(7736002)(66066001)(106356001)(2351001)(68736007)(74316002)(99286004)(316002)(2501003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR15MB1155;H:BN6PR15MB1396.namprd15.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1;
received-spf: None (protection.outlook.com: n2net.com does not designate
permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info:
XkE22M3AU0W534B8pOHMiJOhuf2rLC8LN/nbttJG81yVeWghDgJrk8aFZ04ZQ5kJVhz3pUWXc2Ge/xqAsTo2Pv7W5fFPPFIlpMd87CeVsgUdW8gSxaxcli/FnLA46ybK0PsADYOWBRqvaZ5ayEkZedxwe8dPKjOsi789SqGfuCy7y0usLjmaGRsvfFEpTGSa5JmMyqWsPtC2A5iEs6kzLmkuUXrcNBNfJ8k0Mvi2ok1kBY0ehf20sb/hrOAC3vgtPi0EY86t3SpBKMzFA610wmFOmALi4FPpvoyHnRV+TOc9Kgj49wAhAd/nSHC178JmP+ay7tTsxX6GBX8gcb9mJSSCUy4HifWM7K5IyVwpBs90sxZooN/4Pr3IZMm6iV/C+mYZ+k36gpAv91GTxs9cyWdGjuV+GvE5qyNMfe6w9vw=
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-OriginatorOrg: n2net.com
X-MS-Exchange-CrossTenant-Network-Message-Id: e1061bb9-6944-4f6c-928c-08d680758181
X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jan 2019 14:25:49.1405
(UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 22f40af6-63b3-4367-a32e-781031f4a7bb
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR15MB1155
X-Originating-IP: 40.107.69.67
X-Country: code=US country="United States" ip=40.107.69.67
X-ORBS-Stamp: hostkarma_yellow, hostkarma_quitok
X-Rcpt-To: <surgemail-list@netwin.co.nz>
X-SpamDetect: : 0.0 sd=0.0 lv=0.00 nok=1/0 m=1 nf=0 Close 0.03(X-SpamContent:clean) 0.04(X-myrbl:Color=white) 0.90(X-Phrase:isspam) 0.88(three_words) 0.88(Whole message is base64 e) 0.77(X-Verify-Helo:-ERR) 0.27(StandardTLD) 0.28(X-Verify-MX present) 0.29(genuine) 0.29(dkimok) 0.38(X-NotAscii:utf) 0.42(X-Verify-Helo:wrongip) 0.43(X-LangGuess:English) Saned 5.0 Sval 0.0 bsan 5.0 Moved 5.0->0.0 Sval 0.0
X-NotAscii: charset=utf-8
X-SpamContent: Clean
X-LangGuess: English
X-Probe: +OK skipped, known ip address
X-Phrase: IsSpam score=1.00
X-Verify-Helo: -ERR wrongip: NAM04-CO1-obe.outbound.protection.outlook.com -> 216.32.*.* not in 40.107.69.67
Authentication-Results: netwin.co.nz header.from=JimL@n2net.com; dkim=pass (good signature)
X-Verify-MX: <JimL@n2net.com> senders ip (ch=40.107.69.67 msg=40.107.69.67, net=40.107.) not in mx data dom=n2net.com ipname=mail-eopbgr690067.outbound.protection.outlook.com (207.166.203.21)
X-Encryption: SSL encrypted
X-MyRbl: Color=White Age=390 Spam=3 Notspam=5 Stars=21 Good=2449 Friend=4717 Surbl=2 Catch=0 r=0.0067 ip=40.107.69.67
X-IP-stats: Incoming Last 0, First 8, in=1, out=0, spam=0 ip=40.107.69.67
List-Unsubscribe: <mailto:surgemail-list-leave@netwin.co.nz?subject=unsubscribe>
X-Mailing-List: surgemail-list@netwin.co.nz
List-ID: <surgemail-list@netwin.co.nz>
Precedence: bulk
Reply-To: surgemail-list@netwin.co.nz
ChrisP,
I re-ran my tests using your examples and it sort of works. The problem is that the rule appears to modify other parts of the header. Specifically, it appears to strip the white space character (in this case a horizontal tab) from the header. This results in the email client not being able to fully interpret the To header.
Example: "To:" header NOT changed by replace.
To: "someone@domain1.tld" <someone@domain1.tld>, "support@n2net.net"
<support@n2net.net>, "someone@domain2.tld" <someone@domain2.tld>
Example: "To:" header changed by replace.
To: "someone@domain1.tld" <someone@domain1.tld>, "support@n2net.net"
<support@n2net.net>, "someone@domain2.tld" <someone@domain2.tld>
Is there any way to prevent replace from mangling long header lines?
Thank you,
Jim L
-----Original Message-----
From: Surgemail Support <surgemail-support@netwinsite.com>
Sent: Thursday, January 17, 2019 3:58 PM
To: surgemail-list@netwin.co.nz
Subject: Re: [SurgeMail List] mfilter replace email address
Use this:
if (isin("to","support@n2net.com")) then call replace("to","*support@n2net.com*","%1support@n2net.net%2")
call replace("to","*support@n2net.com*","%1support@n2net.net%2")
end if
In brief:
1) replace needs 'call' in front of it.
2) don't use recipients, that is a loop for each envelope recipient, whereas you want to do this for the header which is not related to the recipients.
3) do it twice, so that it picks up two instances in the single header.
ChrisP.
On 18/01/2019 3:59 AM, Jim Lohiser wrote:
> SurgeMail List,
>
> We have a need to rewrite an email address in message headers. I am attempting to write an mfilter rule to make this happen. I have created the following rules.
>
> recipients
> if (isin("recipient","support@n2net.com")) then
> replace("to","support@n2net.com","support@n2net.net")
> end if
> end recipients
>
> This works. It replaces both the email address and the "name" portion in the To address (see below).
>
> To: "support@n2net.net" <support@n2net.net>
>
> HOWEVER, if the message has multiple recipients, then the rule does not work.
>
> To: "johndoe@domain1.tld" <johndoe@domain1.tld>, "support@n2net.com"
> <support@n2net.com>, "janedoe@domain2.tld" <janedoe@domain2.tld>
>
> I know the isin() test is working because I added a "call report()" to the rule block and it sends me a report email. I have tried adding wildcards to the rule (see below), but this also does not work.
>
> replace("to","*support@n2net.com*","%1support@n2net.net%2")
>
> Is there any way to replace all instances of an email address in a header?
>
> Thanks in advance,
>
> Jim Lohiser
> N2Net
>
|