Closed bellegarde-c closed 9 months ago
The name is not allowed to contain raw []'s. From rfc5322:
address = mailbox / group
mailbox = name-addr / addr-spec
name-addr = [display-name] angle-addr
angle-addr = [CFWS] "<" addr-spec ">" [CFWS] /
obs-angle-addr
group = display-name ":" [group-list] ";" [CFWS]
display-name = phrase
word = atom / quoted-string
phrase = 1*word / obs-phrase
atext = ALPHA / DIGIT / ; Printable US-ASCII
"!" / "#" / ; characters not including
"$" / "%" / ; specials. Used for atoms.
"&" / "'" /
"*" / "+" /
"-" / "/" /
"=" / "?" /
"^" / "_" /
"`" / "{" /
"|" / "}" /
"~"
atom = [CFWS] 1*atext [CFWS]
specials = "(" / ")" / ; Special characters that do
"<" / ">" / ; not appear in atext
"[" / "]" /
":" / ";" /
"@" / "\" /
"," / "." /
DQUOTE
As you can see here, a display-name
needs to match the phrase
syntax, which is 1-or-more word
tokens where each word
token is either a quoted-string
or an atom
. An atom
must only consist of Alpha-Numeric characters or one of the allowed punctuation characters from the atext
definition which does not include [
or ]
.
Yes I know but Thunderbird and Outlook allow them... :(
Is this something that the user is typing into the To text box in the message composer? Or what is the scenario?
Mail received from a Thunderbird/Outlook client from "user[compagny] user@compagny.com", you reply and geary just fails to validate sender.
Okay, but that sounds like Geary isn't properly quoting the name when it stuffs it into the text field though, right?
Because obviously gmime properly parsed it from the From header in order for the []'s to end up in the To textbox when hitting reply.
You reply and Geary just fails to validate the sender means "send button disabled" because of textbox content.
What I'm suggesting is that Geary needs to format the email address such that the []'s are inside a quoted-string when it adds the email address to an address field in your composer window.
If Geary is using internet_address_to_string() or internet_address_list_to_string(), there might be a bug there, but it's not a bug in the parser.
Ok, wil give a look! Thanks!
Did that solve the problem?
Sorry, did not find time to but will.
See [geary#1385](https://gitlab.gnome.org/GNOME/geary/-/issues/1385)
Geary is using GMime.InternetAddressList.parse() to validate email addresses but it returns NULL when having square bracets.