Link to home
Start Free TrialLog in
Avatar of dolythgoe
dolythgoe

asked on

SPF record and mailing problems

Hi,

Following on from the support I had here: https://www.experts-exchange.com/questions/27422536/PHP-mailout-and-spam-filters.html

I've now had a chance to get things up and running but the emailing doesn't seem to work at all now I've added an spf record.

The DNS is managed with cpanel's DNS cluster management and the entry looks like this:

 User generated image
The domain.com is obv replaced with the real domain and I've just used x's to hide the 2 different IPs. These IPs are the webservers which run the php script to send mail.

With this interface, I can't leave the first box blank, it always puts the domain in.

Now, I'm very confused with this setup. I have a load-balanced setup on 2 webservers and the hosts have a centralised mail sending system of which I think it's using. Here's what the hosts said:


The "via" will always happen, and is a completely supported/standard way of doing things. In order for it to work you need to specify an SPF record on your domain that grants the FQDN vded-dc-xxx.servers.wirehive.net to send as domain.com. You will need this delegation for any SMTP server you send from. You will need to list EVERY source that you send email from. There is a wizard to generate the SPF record here: http://www.mailradar.com/spf/

Once you have the SPF string you insert this as a TXT record on your parent domain in the DNS control panel.

Now, I visited this wizard but still have no real clue on what to input. Is my spf record wrong? This worked before I added it.

PHP mail sending:

$message = 'some text...';

$headers = "From: Domain Mailer <noreply@domain.com> \n";  
$headers .= "Reply-To: noreply@domain.com\n"; // Reply address  
$headers .= "Content-Type: plain/text; charset=iso-8859-1"; //Enc-type 

$subject = 	'Account Activation';
mail($email, $subject, $message, $headers);

Open in new window


Thanks for any help
SOLUTION
Avatar of Jayachandran Palanisamy
Jayachandran Palanisamy
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dolythgoe
dolythgoe

ASKER

Cool thanks.

Well I tried the later one first and it worked for gmail but no sign of the email in Hotmail. Is hotmail more stringent?

I'll try the authentication method to see if that improves things.

You've got a require_once 'Mail.php' <- I don't have such a file..? What's this for?

Thanks again
Actually sorry, it did appear in Hotmail - in the Junk folder:

"Microsoft SmartScreen classified this message as junk."

Do you think the authentication will improve that?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you paste the headers of the mail you just received in the spam folder, I can tell you exactly what needs to be done.  Pretty sure however your problem can be fixed with my original solution.
Ah yes, sorry, I remember you saying that last time - added now.

I did a test and it worked in gmail fine - the via didn't even show up. For hotmail, still waiting on the email. It seems it has been completely blocked this time.

Here's my php:

//$email & $message vars formed earlier

$headers = 'From: Admin <admin@domain.com>' . "\r\n" . 
'Reply-To: admin@domain.com' . "\r\n" . 
'X-Mailer: PHP/' . phpversion();
$subject = 	'Account Activation';
mail($email, $subject, $message, $headers, '-fadmin@domain.com');

Open in new window


And here's google report:

Delivered-To: xxx@googlemail.com
Received: by 10.182.43.226 with SMTP id z2cs415263obl;
        Thu, 24 Nov 2011 13:24:31 -0800 (PST)
Received: by 10.180.4.167 with SMTP id l7mr30545635wil.51.1322169869633;
        Thu, 24 Nov 2011 13:24:29 -0800 (PST)
Return-Path: <admin@domain.com>
Received: from vded-dc-xxx.servers.wirehive.net (vded-dc-xxx.servers.wirehive.net. [91.xxx.xx.xx])
        by mx.google.com with ESMTP id cz6si11263828wib.72.2011.11.24.13.24.29;
        Thu, 24 Nov 2011 13:24:29 -0800 (PST)
Received-SPF: pass (google.com: domain of admin@domain.com designates 91.xxx.xx.xx as permitted sender) client-ip=91.xxx.xx.xx;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of admin@domain.com designates 91.xxx.xx.xx as permitted sender) smtp.mail=admin@domain.com
Received: by vded-dc-xxx.servers.wirehive.net (Postfix, from userid 33)
      id DFB07320621; Thu, 24 Nov 2011 21:29:11 +0000 (GMT)
To: xxx@googlemail.com
Subject: Account Activation
X-PHP-Originating-Script: 1001:signup_process.php
From: Admin <admin@domain.com>
Reply-To: admin@domain.com
X-Mailer: PHP/5.3.5-1ubuntu7.3
Message-Id: <20111124212911.DFB07320621@vded-dc-xxx.servers.wirehive.net>
Date: Thu, 24 Nov 2011 21:29:11 +0000 (GMT)
Hotmail caches SPF records on the backend, so it may be due to that.

If the GMail test passes, and it did, then you are now good to go.

Received-SPF: pass (google.com: domain of admin@domain.com designates 91.xxx.xx.xx as permitted sender) client-ip=91.xxx.xx.xx;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of admin@domain.com designates 91.xxx.xx.xx as permitted sender) smtp.mail=admin@domain.com
Cool :) - is there anything I can do to improve it's 'likeability'. The link Jay provided talks about a few things. Is it worth stating it's content type in the header (plain text).

Thanks guys for your help at least I've got to a good place!

You should be just fine as-is.
I did another test and all is good - appeared in the Inbox!

Ahhh, a headache cleared :) - thanks a lot.
Happy to help.