Reduce Gravity Forms spam false positives with multipart emails

Standard Gravity Forms notification emails are HTML emails. They don’t have a plain text part, which some spam filters flag as maybe spam. Stop this happening by making them multipart emails.

Gravity Forms has a nice default email notification which is a formatted HTML table. It sends this simplistically as an HTML-only email. Increasingly, spam filters such as Spamassassin are giving spam scores to emails that only have HTML parts without an additional plain text part.

Making matters worse, the To: address in Gravity Forms can only be a simple email address. Spamassassin aggressively views plain email address for recipients as another spam indicator — it prefers them in the form “Person Name <Person.Name@example.com>”

The two indicators combined are just too much for Spamassassin sometimes, adding the flag TO_NO_BRKTS_HTML_ONLY which is typically 2 points out of 5. (Spam points and thresholds are configurable, but these are the typical numbers). If your emails get points from anywhere else, those 2 points can tip you over the edge and into people’s Junk folders.

If you find that this is happening to your email notifications, the easy way out is to force Gravity Forms to add a plain text part. It does this quite happily, stripping HTML tags automatically, so really it’s a no brainer.

/**
 * force Gravity Forms HTML notifications to add a plain text fallback
 * this reduces the risk of Spamassassin and others from marking emails as spam
 * @param array $notification
 * @return array
 */
add_filter('gform_notification', function($notification) {
    if (rgar($notification, 'message_format', 'html') === 'html') {
        $notification['message_format'] = 'multipart';
    }
    return $notification;
});

Job is done without Spamassassin throwing a tizzy.