It is not an SMTP header, that is correct. It is the “From” line which precedes the actual mail in many situations. Normally when mail is delivered locally, the message, including this line, is simply appended to the destination user’s mailbox, and this line itself defines the start of each email. (see Mbox - Wikipedia) - In the case of RT though, it’s being piped into rt-mailgate, still including the line.
RT then uses MIME::Tools to parse the incoming mail. Here’s what its README says about these lines:
Ignoring non-header headers
People like to hand the parser raw messages straight from POP3 or from a
mailbox. There is often predictable non-header information in front of
the real headers; e.g., the initial "From" line in the following
message:
From - Wed Mar 22 02:13:18 2000
Return-Path: <eryq@zeegee.com>
Subject: Hello
The parser simply ignores such stuff quietly. Perhaps it shouldn't, but
most people seem to want that behavior.
But I don’t know what it means by “ignoring” since it still ends up populating the headers in the ‘Attachments’ table. I guess it just means it doesn’t throw an error? Is my copy of MIME::Tools (Debian, 5.509-1) broken?
Maybe there is something in exim’s config I can change so that the line isn’t included when piping, but I haven’t been able to find it yet.
So, this seems like a bug in RT, because as far as I can tell, I’m using rt-mailgate correctly. It’s a relatively subtle problem, so my guess is many people are affected and just don’t know it. I’d like to know who does NOT see these non-headers in their database, if they look at Attachments.Headers for those incoming mails?
It’s easy for me to see them (in MariaDB/MySQL) with:
SELECT id, REGEXP_SUBSTR(Headers, '(?m)^From .*$') FROM Attachments WHERE Headers RLIKE '(?m)^From .*$' LIMIT 40