Hi, I have to filter out some tags from outgoing email subject field. I use the following filter: if $h_subject: matches \N\[\NTAG1|TAG2|TAG3\N\]\N then headers add "tmpSubject: ${sg{$bh_subject:}{\\\\[(TAG1|TAG2|TAG3)\\\\]\\\\ }{}}" headers remove "Subject" headers add "Subject: $h_tmpSubject" headers remove "tmpSubject" endif and it works fine while users send emails with email clients and subject is ISO-8859-1 plain text. But some users do it with Google Mail’s web interface. Then outgoing email subject is in UTF-8 and encoded with Base64. Based on «String expansion» section of documentation, I have tried to add second stage to the filter with the same content, but prepended with headers charset "UTF-8" - no luck. Then I’ve tried to determine the problem. I’ll bypass some intermediate steps, but I have ended with following in filter: headers charset "UTF-8" headers add "tmpB64decodedSubject: $bh_subject" headers add "hSubject: $h_subject" In my understanding of «String expansion» this both should result with additional headers, decoded from Base64 — however, I’m getting three identical headers: Subject: =?UTF-8?B?UmU6IFtFWFRFUk5BTF0gUmU6IFJlOiBSZTog0JzQsNGA0YjRgNGD0YLQuNC30LDRhtC4?= Ñ Ð¿Ð¾ÑÑÑ tmpB64decodedSubject: =?UTF-8?B?UmU6IFtFWFRFUk5BTF0gUmU6IFJlOiBSZTog0JzQsNGA0YjRgNGD0YLQuNC30LDRhtC4?= Ñ Ð¿Ð¾ÑÑÑ hSubject: =?UTF-8?B?UmU6IFtFWFRFUk5BTF0gUmU6IFJlOiBSZTog0JzQsNGA0YjRgNGD0YLQuNC30LDRhtC4?= Ñ Ð¿Ð¾ÑÑÑ Once again, according to my understanding of «String expansion» this means that Exim cannot decode the original header for some reason. I have tried to decode « UmU6IFtFWFRFUk5BTF0gUmU6IFJlOiBSZTog0JzQsNGA0YjRgNGD0YLQuNC30LDRhtC4» manually on the same server with echo UmU6IFtFWFRFUk5BTF0gUmU6IFJlOiBSZTog0JzQsNGA0YjRgNGD0YLQuNC30LDRhtC4 | base64 -d and it works fine: Re: [EXTERNAL] Re: Re: Re: Маршрутизаци (tag [EXTERNAL] is one of the actual tags in use). What am I doing wrong in filters? Or how can I do further diagnostic to determine why Exim cannot decode the headers? Does multiline in subject header influences the result? Best regards, Kirill Sluchanko -- ## List details at https://lists.exim.org/mailman/listinfo/exim-users ## Exim details at http://www.exim.org/ ## Please use the Wiki with this list - http://wiki.exim.org/
[exim] Problem with filter on Base64-encoded subject field
Kirill Sluchanko via Exim-users Tue, 15 Dec 2020 09:05:38 -0800
- [exim] Problem with filter on Base64-encod... Kirill Sluchanko via Exim-users
- Re: [exim] Problem with filter on Bas... Andreas Metzler via Exim-users
- Re: [exim] Problem with filter on... Jeremy Harris via Exim-users
- Re: [exim] Problem with filt... Kirill Sluchanko via Exim-users
- Re: [exim] Problem with filter o... Kirill Sluchanko via Exim-users
- Re: [exim] Problem with filter on Bas... Lena--- via Exim-users
- Re: [exim] Problem with filter o... Kirill Sluchanko via Exim-users