The message.parse method includes the following line [1] message.sub! /\AFrom .*\r?\n/i, '' if message =~ /^\AFrom /i
What purpose does it serve? And why is the matching case-insensitive? AFAICT the mail Gem is be able to handle a leading From_ line, and uses it to populate envelope_from and envelope_date. Also the check for headers terminated by LF rather than CRLF looks wrong: if headers.include? "\n" and not headers.include? "\r\n" AFAICT that will not pick up the case where there are mixed EOLs in the headers. If there is no need to strip the From line, then it will reduce the number of mails that have to be adjusted (AIUI all mails have the from line). S. [1] https://gitbox.apache.org/repos/asf?p=whimsy.git;a=blob;f=www/secretary/workbench/models/message.rb;h=9ce90bc38d76f23ba6707b4af201ced93493ef24;hb=HEAD#l336