Author Topic: [1.6.1] E-Mail: Wrong Message-ID in Header  (Read 4565 times)

sokki

  • Newbie
  • *
  • Posts: 7
    • View Profile
[1.6.1] E-Mail: Wrong Message-ID in Header
« on: January 13, 2010, 04:17:20 pm »
Hi,

my fengoffice generates emails with a message-id in header like:
Quote
Message-ID: <og_1263400207_375307@xxx.de> <webmaster@xxx.de>

This breaks two rules of SpamAssasin :
Quote
1.6 MSGID_SPAM_LETTERS     Spam tool Message-Id: (letters variant)
 2.6 INVALID_MSGID          Message-Id is not valid, according to RFC 2822

Thanks a lot for this great tool!


ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: [1.6.1] E-Mail: Wrong Message-ID in Header
« Reply #1 on: January 19, 2010, 04:13:24 pm »
Strange, Feng Office shouldn't be adding the <webmaster@xxx.de> part.

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: [1.6.1] E-Mail: Wrong Message-ID in Header
« Reply #2 on: January 19, 2010, 04:28:54 pm »
Ok, found what could be causing that. Try changing file 'library/swift/lib/Swift.php' line 1624 to:

Code: [Select]
public function buildMail($to, $from, $subject, $body, $type='text/plain', $encoding='8bit', $return_data_part=true, &$complete_mail)
{
if ($this->message_id) {
$msg_id = $this->message_id;
} else {
$id_right = substr($from, strpos($from, '@'));
if (strpos($id_right, ">") !== false) {
$id_right = substr($id_right, 0, strpos($id_right, ">"));
}
$id_right = preg_replace('/[^a-zA-Z0-9\.\!\#\/\$\%\&\'\*\+\-\=\?\^\_\`\{\|\}\~]/', '', $id_right);
$msg_id = "<" . gen_id() . "@" . $id_right . ">";
}

$date = date('r'); //RFC 2822 date
« Last Edit: January 22, 2010, 02:25:19 pm by ignacio »

sokki

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: [1.6.1] E-Mail: Wrong Message-ID in Header
« Reply #3 on: January 22, 2010, 01:40:03 pm »
Hi ignacio,

thanks for the fix!

the messageid looks better now:
Quote
Message-ID:     <og_1264174702_167123>
this fix the MSGID_SPAM_LETTERS rule.

But Spamassasing sill throw:
Quote
2.6 INVALID_MSGID          Message-Id is not valid, according to RFC 2822

edit:
I've commented out the preg_replace() line cause it removes the @xxx.de part. SpamAssasin is happy now :-) with a messageid like:
Quote
<og_1264175573_712876@xxx.de>
« Last Edit: January 22, 2010, 01:53:49 pm by sokki »

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: [1.6.1] E-Mail: Wrong Message-ID in Header
« Reply #4 on: January 22, 2010, 02:26:42 pm »
Yes, made two corrections to the code I posted. Added a missing ']' to the preg_replace and added an '@' to the following line.