apache / apache/ponymail-foal

Detect bare 'From ' lines in email bodies when importing mbox archives

Open
#242 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
45
Forks
23
PR merge metrics
No merged PRs in 30d

Description

Lines starting with 'From ' are not supposed to appear in message bodies, as these indicate the start of a new mbox email.

One way to detect these would be to check whether the parsed email has any headers.
This is unlikely for the case of an embedded 'From '.
If the mail has no headers, then it is almost certainly due to an un-quoted 'From '.

It could then be processed accordingly.

Simplest would be to drop it, but that means the content of its original email would be missing.
It could be reported, along with the details of the previous valid 'From ' line. This could then be fixed later.
It could potentially be added to the body of the previous email.
etc.
Note that there can be multiple 'From ' lines in a single email body.

Whilst it would be possible to make 'From ' line matching stricter, this would not help in the case where a valid 'From ' line is included in an email body.

Also of course, an email that includes several headers along with the 'From ' line would not be detected, but that is not likely to be a common occurrence.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the mbox archive import and email parsing entry points; the issue names no files or tests. Determine and document the intended handling for bare 'From ' lines, including multiple lines and preservation or reporting of the affected content, then add coverage for the agreed behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.