I've 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 send via warning.othercorp.net
$to = "someone@outloook.com";
$subject = 'Warning!';
$message = 'hello! You\'ve been warned!';
$headers = 'From: warning@myawesomedomain.com' . "
" .
'Reply-To: info@myawesomedomain.com' . "
";
$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 domain of warning@myawesomedomain.com) client-ip=222.222.222.222;
I guess Outlook is flagging email as span because it has the same problem of GMAIL, what should I do?
Thank you!
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.