Re: [exim] Unfold and rewrite multi-line headers

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Dmitriy Matrosov
Date:  
À: exim-users
Sujet: Re: [exim] Unfold and rewrite multi-line headers
On 04/13/2018 11:55 PM, Jasen Betts via Exim-users wrote:
> On 2018-04-13, Dmitriy Matrosov via Exim-users <exim-users@???> wrote:
>> Hi.
>>
>> Can exim unfold and decode entire multiline header (`Subject` particularly)?
>
>> Here is the first part of multiline header:
>
>> Subject:
>> =?UTF-8?B?RndkOiBVUkdFTlQ6IFtOb3RpY2UgSUQgKndtVVJwRCpdINCY0YHQv9C+?=
>> =?UTF-8?B?0LvRjNC30L7QstCw0L3QuNC1INC40L3RgtC10LvQu9C10LrRgtGD0LDQu9GM0L0=?=
>
> You're going to have to tell it to disobey RFC2047 if you want that to
> appear human readable, (the last part is oversize) if there's no line
> break after 'Subject:' the first part is too.
>
> main configuration: check_rfc2047_length = no
> https://www.exim.org/exim-html-current/doc/html/spec_html/ch-main_configuration.html
>
> after that change $h_subject: shoulf have the value you want.
>


Thanks for answer! I've tried `check_rfc2047_length = no` and it
indeed fixes the decoding part. I.e. now `$h_Subject` and manual
method with `reduce`

     ${reduce {<, ${sg {$rh_Subject:}{\\n([ \\t])}{,}}} {} 
{$value${rfc2047d:$item}}}


both decode entire header. But i noticed now, that encoding generates
single-line header (though, with many words). I.e. this

     headers_remove  = Subject
     headers_add = Subject: ${rfc2047:***** VIRUS ***** $h_Subject:}


results in a single line

     Subject: 
=?UTF-8?Q?*****_VIRUS_*****_Fwd=3A_URGENT=3A_=5BNotice_ID_*wmURpD*=5D_?= 
=?UTF-8?Q?=D0=98=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0?=


Though, i may split it to multiple lines manually

     headers_add = Subject: ${sg {${rfc2047:***** VIRUS ***** 
$h_Subject:}} { } {\n }}


but.. is putting each word on a separate line optional?

And still i have doubts about which way is better: decode header using
`h_`, then encode again, or just prepend a word to raw header without
decoding?