mikel / mikel/mail

FWS handling in message ids

Open
#1,607 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
3.7k
Forks
934
PR merge metrics
No merged PRs in 30d

Description

I am curious about the behaviour of the parser for message ids.

```ruby
Mail.read_from_string("Message-ID: < foo\r\n @ example.com\r\n >\r\n").header.fields[0].element.message_ids[0]
```

Yields `" foo @ example.com "`. It means that the library will return different results for message ids which are semantically identical but syntactically different, for example:

- `Message-ID: \r\n`
- `Message-ID: < foo@\t example.com> \r\n`
- `Message-ID: \r\n <\r\n\t foo \r\n @example.com>\r\n`

Unless I am mistaken, all these representations are semantically identical (see RFC 5322 3.6.4., `msg-id = [CFWS] "<" id-left "@" id-right ">" [CFWS]`)and I would expect message ids to be parsed as an object with two fields, `left` and `right`. In all these examples, `left` would be `foo` and `right` would be `example.com`.

Is there a reason behind the current behaviour?

Contributor guide

Open the contributing guide

Research direction

Start by running the Ruby reproduction in the issue and compare its result with the RFC 5322 message-id examples provided. The issue names no files or tests; first locate the message-id parser, then clarify whether the intended outcome is normalization or a structured object with `left` and `right` fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.