Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting header for date to lower SpamAssassin score

I have used a testing service (verifier.port25.com) to check what was happening when emails were getting sent from my PHP script. For some reason they were ending up in my GMail spam folder even though SPF and DKIM are enabled.

It turns out that the SpamAssassin score was 5.3, thus above the 5.0 benchmark. Below you can see why. The biggest problem is that I have a domain with 12 letters in it (it seems crazy to me that I should be punished for this but apparently 12 letter domains are popular among spammers). As I don't want to have to change my domain, it looks like the next best option is to set a header for the date, but I am not sure how to do this. Could someone help with this?

1.0 MISSING_HEADERS Missing To: header

0.0 HTML_MESSAGE BODY: HTML included in message

-0.5 BAYES_05 BODY: Bayes spam probability is 1 to 5% [score: 0.0345]

-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain

0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid

-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature

1.4 MISSING_DATE Missing Date: header

3.5 FROM_12LTRDOM From a 12-letter domain

Existing Array

    $headers = array(
                    'From'          => $from,
                    'Return-Path'   => $sender,
                    'Subject'       => $subject
                    );
like image 606
Nick Avatar asked Jul 24 '12 14:07

Nick


People also ask

What is a good SpamAssassin score?

SpamAssassin works by analyzing an email and giving it a spam score. The lower the score, the better the chances of the email getting delivered successfully. Anything below 5 is considered to be a decent score—above 5 and there is a good chance that the email will be filtered out somewhere before it reaches the inbox.

Where is the SpamAssassin configuration file?

SpamAssassin is configured using traditional UNIX-style configuration files, loaded from the /usr/share/spamassassin and /etc/mail/spamassassin directories.


1 Answers

Try adding this to your headers.

"Date: ".date("r")."\r\n"

For the array:

$headers = array(
                'From'          => $from,
                'Return-Path'   => $sender,
                'Subject'       => $subject,
                'Date'  => date("r")
                );
like image 101
aynber Avatar answered Sep 29 '22 01:09

aynber