All emails sent are flagged as spam

Posted August 27, 2014 3.1k views

Been trying to get mail to send all day without being flagged as spam, but they still are.
My IP is not blacklisted.
Here is the source for one of my emails sent to gmail:

Received: by with SMTP id dh51csp583184web;
        Wed, 27 Aug 2014 13:32:57 -0700 (PDT)
X-Received: by with SMTP id ci3mr32275276wid.57.1409171577616;
        Wed, 27 Aug 2014 13:32:57 -0700 (PDT)
Return-Path: <>
Received: from ([])
        by with ESMTP id az10si3886631wib.11.2014.
        for <>;
        Wed, 27 Aug 2014 13:32:57 -0700 (PDT)
Received-SPF: pass ( domain of designates as permitted sender) client-ip=;
       spf=pass ( domain of designates as permitted sender);
       dkim=neutral (bad version) header.i=@
Received: by (Postfix, from userid 33)
    id 0325540061; Wed, 27 Aug 2014 16:32:57 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;;
    s=mail; t=1409171577;
Subject: A Subject Here
X-PHP-Originating-Script: 0:programmessys.php
Message-Id: <>
Date: Wed, 27 Aug 2014 16:32:57 -0400 (EDT)
From: (no-reply)

Hi there,
This email was sent using PHP's mail function.

This is my SPF record:

"v=spf1 mx a ip4: -all"

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

A small change to you TXT record:

"v=spf1 mx a ip4: ~all"

I have changed the hyphen before “all” to a tilde (~).

Also I find that you’re using Mailgun for handling incoming emails why not use it to send emails too?

Mailgun has instructions on how to configure Postfix to relay emails.

Once done do a mail test.