[exim] Problem with filter on Base64-encoded subject field

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Kirill Sluchanko
Date:  
À: exim-users
Sujet: [exim] Problem with filter on Base64-encoded subject field

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