mikel / mikel/mail

Parsing part of body as header

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

Description

Using version 2.5.4 and running the following script:

```
#!/usr/bin/env ruby
require 'mail'

mail = Mail.read_from_string(DATA.read)
puts mail

__END__
To: someone@example.org
Subject: Test Email

Foo: Bar

Baz
```

I get the following written to stderr:

```
WARNING: Could not parse (and so ignoring) ' Foo: Bar'
```

And stdout gives me:

```
Date: Fri, 15 Nov 2013 01:53:03 +0700
To: someone@example.org
Message-ID: <52851c0f95fa1_5e5d820711b011067@Swan.local.mail>
Subject: Test Email
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit
:

Baz
```

So it appears the first line of the body is parsed as an (empty) header.

Contributor guide

Open the contributing guide

Research direction

Start by running the supplied Ruby script through Mail.read_from_string and trace how the parser handles the blank line before the body. Done means the indented “Foo: Bar” line remains body content, no parsing warning is emitted for it, and the resulting message preserves the body as shown.

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
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.