go-message icon indicating copy to clipboard operation
go-message copied to clipboard

Can't parse email where Message-ID has more than one "@" character

Open gsiehien opened this issue 3 years ago • 2 comments

Hi!

I've noticed that if Message-ID (or any other header using msg-id) has more than one "@" character than parsing via parseMsgID() from header.go fails with:

missing '>' in msg-id

as it expects to consume() special chars in the fallowing order: < , @ , >

i.e.

Message-ID: <113c01d86b4a$53bb4230$fa9e45a$@[email protected]>

I'm not sure if using two or more "@" characters in msg-id is correct but I've already seen a few of this headers in the wild.

gsiehien avatar May 19 '22 08:05 gsiehien

According to https://www.rfc-editor.org/rfc/rfc5322.html#section-3.6.4 having more than one @ inside the msg-id isn't standard compliant and I would recommend fixing the broken implementation instead of accepting non standard stuff in this lib here.

jugendhacker avatar Dec 09 '22 11:12 jugendhacker

For future reference, it's possible to call Text("Message-Id") from mail.Header instead of MessageID to not enter the parseMsgID function.

Microsoft not following specs/RFC as usual it seems: https://community.mailcow.email/d/701-multiple-at-in-message-id/3

mooijtech avatar Feb 10 '23 11:02 mooijtech