I am having a SPF issue sending automatic email to users that register to my website.
When looking at the "original" email in gmail I got the following message with my Cpanel and hostname details instead of the email I sent the email from and my website name. When sending manual emails using webmail it is working just fine.
Here is what I get from Gmail
Delivered-To: [email protected]
Received: by 10.76.116.7 with SMTP id js7csp261337oab;
Fri, 28 Nov 2014 18:37:45 -0800 (PST)
X-Received: by 10.70.133.41 with SMTP id oz9mr78655916pdb.46.1417228665423;
Fri, 28 Nov 2014 18:37:45 -0800 (PST)
Return-Path: <cpanel_login@hostname>
Received: from hostname (hostname [ip address*)
by mx.google.com with ESMTPS id gb9si5051542pac.60.2014.11.28.18.37.44
for <[email protected]>
(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Fri, 28 Nov 2014 18:37:45 -0800 (PST)
Received-SPF: none (google.com: cpanel_logim@hostname does not designate permitted sender hosts) client-ip=ip address;
Authentication-Results: mx.google.com;
spf=none (google.com: cpanel_login@hostname does not designate permitted sender hosts) smtp.mail=cpanel_login@hostname
Received: from cpanel_login by hostname with local (Exim 4.82)
(envelope-from <cpanel_login@hostname>)
id 1XuXun-00065P-Hb
for [email protected]; Fri, 28 Nov 2014 18:37:44 -0800
To: [email protected]
Subject: Activate your account
X-PHP-Script: www.mywebsite.com/email.php for 110.174.16.98
From: "Mywebsite" <[email protected]>
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 8bitReturn-Path: <[email protected]>
Message-Id: <E1XuXun-00065P-Hb@hostname>
Date: Fri, 28 Nov 2014 18:37:41 -0800
To send the email I am using the php mail function
mail($useremail, $subject, $emailBody, $headers);
Any idea about what am I missing? Cheers
If you send email this way the host server will use the default address for your account as a return path. You can try adding a fifth parameter to
mail()
like this:where $returnAddress is the same as your
From:
address.It's not guaranteed as some systems flag the fact that you've used the
-f
parameter as a spam indicator.In any case, you're far better making life easier by using PHPMailer to do the job