You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug MimeMessage.InReplyTo calls MailboxAddress.TryParse and throws ArgumentException if it fails to parse the given value.
I can reproduce this with the following string: [d7e8bc604f797c18ba8120250cbd8c04-JFBVALKQOJXWILKCJQZFA7CDNRQXE2LUPF6EIYLUMFGG643TPRCXQ32TNV2HA===@microsoft.com]
However, MimeMessage.References does not use MailboxAddress.TryParse, thus the same string is accepted and inserted in the references collection.
I also tested with the following code, and it is also working: mimeMessage.Headers.Add(HeaderId.InReplyTo, "[d7e8bc604f797c18ba8120250cbd8c04-JFBVALKQOJXWILKCJQZFA7CDNRQXE2LUPF6EIYLUMFGG643TPRCXQ32TNV2HA===@microsoft.com]")
I'm somewhat confused which is the correct behavior. Shouldn't all three either throw or do not, given the same input string?
Which code should I use if I accept the example string as valid? Or should I trim the invalid characters? Is there a Util class or something I could use for trimming?
The text was updated successfully, but these errors were encountered:
MimeKit was designed to be strict in what it will send (which requires strictness in what it would accept as values for message.InReplyTo = ..., etc) but relaxed in what it would accept (e.g. MimeMessage.Load).
Over time, I've had to dumb down the message-id parser(s) that are used for various property setters because of the need to be able to reply to messages with garbage message-ids (presumably like in your situation).
It looks like I need to do the same for the InReplyTo property setter.
These properties now use ParseUtils.TryParseMesgId() which is more lenient in
what it accepts which is needed if/when a reply is being constructed for a
message with a syntactically incorrect Message-ID.
Also fixed ParseUtils.TryParseMsgId() to handle Message-Id's like:
<[[email protected]]>
Fixes issue #912
Describe the bug
MimeMessage.InReplyTo
callsMailboxAddress.TryParse
and throwsArgumentException
if it fails to parse the given value.I can reproduce this with the following string:
[d7e8bc604f797c18ba8120250cbd8c04-JFBVALKQOJXWILKCJQZFA7CDNRQXE2LUPF6EIYLUMFGG643TPRCXQ32TNV2HA===@microsoft.com]
However,
MimeMessage.References
does not useMailboxAddress.TryParse
, thus the same string is accepted and inserted in the references collection.I also tested with the following code, and it is also working:
mimeMessage.Headers.Add(HeaderId.InReplyTo, "[d7e8bc604f797c18ba8120250cbd8c04-JFBVALKQOJXWILKCJQZFA7CDNRQXE2LUPF6EIYLUMFGG643TPRCXQ32TNV2HA===@microsoft.com]")
I'm somewhat confused which is the correct behavior. Shouldn't all three either throw or do not, given the same input string?
Which code should I use if I accept the example string as valid? Or should I trim the invalid characters? Is there a Util class or something I could use for trimming?
The text was updated successfully, but these errors were encountered: