mikel / mikel/mail

(invalid) addresses with > breaks parser

Open
#1,297 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 got an email with an invalid `To` field.
Notice the `>` at the end of the address.
(Example is stripped down to the relevant parts):

```Date: Fri, 12 May 2017 17:49:04 +0200
From: Example
To: info@example.com>
Subject: =?UTF-8?Q?Test_Mail?=

Test Mail=0D
=0D
```
Getting:
```ruby
Mail.new(..).to # => "info@example.com>"
```
expected:
```ruby
Mail.new(..).to # => ["info@example.com>"]
```
Thunderbird automatically strips the invalid `>` so this would be a bonus.

One more example with multiple addresses:
```
Date: Fri, 12 May 2017 17:49:04 +0200
From: Example
To: info@example.com>, info2@example.com
Subject: =?UTF-8?Q?Test_Mail?=

Test Mail=0D
=0D
```
Getting
```ruby
Mail.new(..).to # => "info@example.com>, info2@example.com"
```
expected:
```ruby
Mail.new(..).to # => ["info@example.com>", "info2@example.com"]
```

As those emails really exist (the sender used the 'goneo Webmail', a german mail-hosting company) a fix within the gem which helps other ppl, too, would be much appreciated.

Please let me know if this would be a possible option.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the two raw To-field examples and inspect the address-parsing entry point reached by Mail.new(..). Compare the current scalar results with the expected address arrays, including the single trailing > and the comma-separated case. Done means both examples parse into the expected recipient lists without breaking valid addresses.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.