I wrote to Josh about this a few days ago, but apparently my email did not get through.
There is an issue in the sendMail sub in file mailhandler/spameater -
When it adds the SpamGourmet information to a Subject header, if the header spans multiple lines, then the information is
appended to the first line, when it should be the last.
Example - portion of headers from an email I got through SpamGourmet (note the 2-line subject header):
- Code: Select all
Date: Sun, 28 Oct 2018 17:53:49 +0200
Subject: This is a Long Header, to show the Issue, (tmp: message 17 of 20)
Note it's actually not that long, but you can still see the problem.
X-Remote-Spamgourmet: (tmp: message 17 of 20)
You can see the information (tmp: message 17 of 20) is in the middle of the Subject header. That's because the header
originally spans 2 lines. According to RFC 2822 (section 2.2.3. Long Header Fields) - a header can indeed span more than 1 line,
as long as the next lines (after the 1st) start with whitespace.
It should have been forwarded like this:
- Code: Select all
Date: Sun, 28 Oct 2018 17:53:49 +0200
Subject: This is a Long Header, to show the Issue,
Note it's actually not that long, but you can still see the problem. (tmp: message 17 of 20)
X-Remote-Spamgourmet: (tmp: message 17 of 20)
The fix for this issue is a small change in the regex used in line 808 at sub sendMail in the file mailhandler/spameater:
Simply, replace this line:
- Code: Select all
my $check = $$msgref =~ s/(^Subject\:.*$)/$1$subjecttext/mi;
With this one:
- Code: Select all
my $check = $$msgref =~ s/(^Subject\:(.|(\n\s))*$)/$1$subjecttext/mi;
Could someone please, please, implement this fix in the spamgourmet site?
Many thanks
Ron