Fork me on GitHub
Subscribe 2

Ticket #297 (fixed enhancement)

Forum e-mails get rated as spam by SpamAssassin

  • Created: 2011-02-19 08:13:44
  • Reported by: Christian
  • Assigned to: Reines
  • Milestone: 1.4.5
  • Component: email
  • Priority: normal

I've encountered problems receiving FluxBB's e-mails on several GMX accounts.

Looking at the e-mail's source showed that GMX uses SpamAssassin to detect spam and in particular the rule "FROM_EXCESS_BASE64" seemed to be responsible for a 5+ spam rating. … ESS_BASE64

The rule fires when you base64 encode parts of the e-mail header even when there is no reason to do so.

FluxBB encodes "from", "subject" and "receiver", independent of their character encoding: … il.php#L65

There are two solutions to this:

1. Only base64encode when there are UTF8 chars
2. Q-Encode this strings

Because PHP doesn't provide a function to q-encode strings, I decided to go for the first solution:

// Only encode with base64, if there is at least one unicode character in the string
function encode_mail_text($str)
    if (preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches))
        $str = "=?UTF-8?B?".base64_encode($str)."?=";
    return $str;

Then replace line 65 and 66 in email.php:

$from = encode_mail_text($from_name).' <'.$from_email.'>';
    $subject = encode_mail_text($subject);

and line 73:

$reply_to = encode_mail_text($reply_to_name).' <'.$reply_to_email.'>';

This code is tested and works quite well, but my eclipse-git client won't let me commit this piece of code.

So please review and commit.


Reines 2011-02-19 12:59:55

  • Owner set to Reines.

Reines 2011-02-19 13:21:02

  • Status changed from open to fixed.

Cheers, fixed.