corecode / dma

The DragonFly Mail Agent, a small Mail Transport Agent (MTA), designed for home and office use.
Other
231 stars 50 forks source link

Add support for RFC976 "From_ lines #69

Closed drscream closed 5 years ago

drscream commented 5 years ago

Add support for UUCP "From_ lines". RFC976 describes these as:

... the "source path" (normally
represented in one or more lines at the beginning of the message
beginning either "From " or ">From ", sometimes called "From_
lines".)

This fixes an issue where emails generated by cron would have their headers in the mailbody. If the first line starts with "From " or ">From " the line is skipped instead of parsing everything as body.

drscream commented 5 years ago

This patch is a modified version of OmniOSce from.patch file to match the RFC.

corecode commented 5 years ago

can you explain under which conditions a message is sent with this format? What do other MTAs (sendmail/postfix) do?

drscream commented 5 years ago

These messages are send from illumos cron daemon for example. The following information could be provided to other MTAs:

corecode commented 5 years ago

I think we should only drop the From lines at the very beginning of the message (like postfix). Maybe we should also drop From lines with multiple leading >.

drscream commented 5 years ago

I've updated my pull request to only check the very beginning of the message. About dropping From_ lines with multiple >: I'm really not sure if that would be part of the RFC, I've not found any information about messages with multiple >.

corecode commented 5 years ago

could you call it had_first_line or rename the other variable to had_lastline, just for consistency?

corecode commented 5 years ago

and I guess move the had_first_line = 0 below the continue so that multiple From_ lines will be skipped.

corecode commented 5 years ago

Sorry to give feedback only piecemeal. Maybe we should add a comment what this From_ line skipping is about.

drscream commented 5 years ago

No worry, I appreciate your feedback. A comment has been added :-)