Reputation: 3155
I have the following setup:
Server 1 (client-server):
111.111.111.111
myawesomedomain.com
with
email server."V=SPF1 A MX INCLUDE:MYAWESOMEDOMAIN.COM ip4: 222.222.222.222/32 ?ALL"
Server 2 (one of my machines):
warning.othercorp.net
222.222.222.222
.I want to use the server 2, via PHP mail()
function to send email email warning to registered users in a back office.
I tried to send mail with a simple PHP script like the following but it gets marked as SPAM in Oulook.com and GMAIL says it was sent via warning.othercorp.net
$to = "[email protected]";
$subject = 'Warning!';
$message = 'hello! You\'ve been warned!';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n";
$res = mail($to, $subject, $message, $headers);
var_dump($res);
I'm not an expert in email sending, but what can I do to avoid emails marked as spam? Wasn't the SPF entry with the IP of the server 2 enough? Why?
Edit:
I was doing some tests, and after viewing the source of a test email sent to an @gmail address, I got this:
Received-SPF: neutral (google.com: 222.222.222.222 is neither permitted nor denied by best guess record for the domain of [email protected]) client-ip=222.222.222.222;
I guess Outlook is flagging the email as spam because it has the same problem of GMAIL, what should I do?
Thank you!
Upvotes: 0
Views: 2754
Reputation: 1
Incorrectly placed or double spaces in an SPF record can invalidate the record.
The record you've shared is:
V=SPF1 A MX INCLUDE:MYAWESOMEDOMAIN.COM ip4: 222.222.222.222/32 ?ALL
There should be no space between ip4:
and 222.222.222.222
That might help solve the remaining issue for you.
Upvotes: 0
Reputation: 19560
To send mail from myawesomedomain.com
, I think the TXT
record for myawesomedomain.com
should be:
"v=spf1 a mx ip4:222.222.222.222 ?all"
Provided that:
A
record for myawesomedomain.com
is your 111.111.111.111
addressI suspect your /32
CIDR notation is causing the issue with the second server.
Upvotes: 1