Mailing List Archive

UTF 8 From header
Hi all,

Is this a legal "From:" header?

> From: =?utf-8?b?IkVsbGEgQmFjaMOpIiA8ZGlnaXRhbEBlbGxhYmFjaGUuY29tLmF1Pg==?=

How would one extract the email address from it using Exim?

I use $rh_from: to extract the header from certain emails and this one
is breaking that. Due to the vast number of broken From: headers I see,
the processing on this header is already quite extensive and I'm
starting to think I will need to offload this processing outside of exim.

Thunderbird doesn't decode it properly; some of the other available
tools I've found either completely fail to decode it or seem to work
just fine.

Thunderbird:
"Ella Baché" <digital@ellabache.com.au> <>
(double email address)
Other tools seem to ignore the empty address, while others just return
the input unchanged.


My current attempts to make sure I get the From header look a bit like this:

> set acl_m_headfrom = ${if eq {${address:$rh_from:}}{} \
> {${sg{${addresses:$rh_from:}}{^.*:}{}}} \
> {${address:$rh_from:}} \
> }
> set acl_m_headfrom = ${if eq {$acl_m_headfrom}{} \
> {${address:${sg{$rh_from:}{@(?=[^@]*@)}{X}}}} \
> {$acl_m_headfrom} \
> }

I moved to using the raw header because of segfaults when attempting the
above with some processed headers.

--
## 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/
Re: UTF 8 From header [ In reply to ]
> On May 1, 2018, at 1:20 AM, Ted Cooper via Exim-users <exim-users@exim.org> wrote:
>
> Is this a legal "From:" header?
>
>> From: =?utf-8?b?IkVsbGEgQmFjaMOpIiA8ZGlnaXRhbEBlbGxhYmFjaGUuY29tLmF1Pg==?=

It is a legal display name (phrase in the language of RFC5322), but it is
missing the address part. The address MUST NOT be encoded as part of
the display name, and must appear separately in the clear.

--
Viktor.


--
## 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/
Re: UTF 8 From header [ In reply to ]
On 2018-05-01, Ted Cooper via Exim-users <exim-users@exim.org> wrote:
> Hi all,
>
> Is this a legal "From:" header?
>
>> From: =?utf-8?b?IkVsbGEgQmFjaMOpIiA8ZGlnaXRhbEBlbGxhYmFjaGUuY29tLmF1Pg==?=

yes. RFC5322 makes no concrete restrictions on From header content.

> How would one extract the email address from it using Exim?

according to RFC2047 the header content is

'"Ella Baché" <digital@ellabache.com.au>'

according to RFC5322 that header does not contain an email address,
only the string '"Ella Baché" <digital@ellabache.com.au>'

> Thunderbird doesn't decode it properly; some of the other available
> tools I've found either completely fail to decode it or seem to work
> just fine.


Anything that finds an email address in there is part of the problem.


RFC2047 requires breaks between atoms in this case a break between the
part than means '"Ella Baché"' and the part that means '<digital@ellabache.com.au>'

RFC5322 reqires literal < > around the email address part.

this would be one way to do it correctly:

From: "=?utf-8?b?RWxsYSBCYWNow6k=?=" <digital@ellabache.com.au>


best move is probably to tell them to use "Ella Bache" as their from name
until they can get their mailer software fixed to that it produces
actual emails, and not merely email-like documents.


--
?

--
## 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/
Re: UTF 8 From header [ In reply to ]
> On May 1, 2018, at 3:31 AM, Jasen Betts via Exim-users <exim-users@exim.org> wrote:
>
> RFC5322 makes no concrete restrictions on From header content.

This is of course false.

https://tools.ietf.org/html/rfc5322#section-3.6.2

from = "From:" mailbox-list CRLF

Which then translates to:

mailbox-list = (mailbox *("," mailbox)) / obs-mbox-list
mailbox = name-addr / addr-spec
name-addr = [display-name] angle-addr
angle-addr = [CFWS] "<" addr-spec ">" [CFWS] / obs-angle-addr

Which, ignoring the obsolete forms rather requires an addr-spec, which
is not a "phrase" and so must not be encoded in structured headers.

--
Viktor.


--
## 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/