im trying to send email from my VPS to a hotmail account using postfix and PEAR Mail, its sends perfectly to yahoo, gmail, but to hotmail goes straight to junk, i know whis question has been asked before, and i've tried everything,
my host name is libreriaplenitud.mx
here's my php script
include('Mail.php');
include('Mail/mime.php');
// Constructing the email
$sender = "Jorge <[email protected]>"; // Your name and email address
$recipient = "El Yorch <[email protected]>"; // The Recipients name and email address
$subject = "Test Email"; // Subject for the email
$text = 'This is a text message.'; // Text version of the email
$html = '<html><body><p>This is a html message</p></body></html>'; // HTML version of the email
$crlf = "\n";
$headers = array(
'From' => $sender,
'Return-Path' => $sender,
'Subject' => $subject
);
// Creating the Mime message
$mime = new Mail_mime($crlf);
// Setting the body of the email
$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$body = $mime->get();
$headers = $mime->headers($headers);
// Sending the email
$mail =& Mail::factory('mail');
if($mail->send($recipient, $headers, $body)){
echo 'email sent succesfully';
}
and here are the headers that hotmail is receiving
Authentication-Results: hotmail.com; spf=none (sender IP is 192.34.60.167)
[email protected]; dkim=none header.d=libreriaplenitud.mx;
x-hmca=none
X-SID-PRA: [email protected]
X-AUTH-Result: NONE
X-SID-Result: NONE
X-Message-Status: n:n
X-Message-Delivery: Vj0xLjE7dXM9MDtsPTA7YT0wO0Q9MjtHRD0yO1NDTD02
X-Message-Info:
11chDOWqoTkNi4xaXoUxBJHNxb4q3jMdTE9occzTaBqAAmPh8MI+3AvSCyxtKvnRXgUwZQ9hB9zRIQG0MbHnJc1TejqWYpS9Vk7aOR7/8zlZcfOTkN+DLYQYashlrK5kkvMohRBt73VDj9hh9fgOPZb7AfegtTPz
Received: from libreriaplenitud.mx ([192.34.60.167]) by COL0-MC1-F2.Col0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4900);
Sun, 14 Apr 2013 14:51:31 -0700
Received: by libreriaplenitud.mx (Postfix, from userid 33)
id 2498040A95; Sun, 14 Apr 2013 21:51:31 +0000 (UTC)
To: El Yorch <[email protected]>
Subject: Test Email
X-PHP-Originating-Script: 0:mail.php
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="=_4404fe2999b34dc58f10c890ae3d5e76"
From: Jorge <[email protected]>
Message-Id: <[email protected]>
Date: Sun, 14 Apr 2013 21:51:31 +0000 (UTC)
Return-Path: [email protected]
X-OriginalArrivalTime: 14 Apr 2013 21:51:32.0085 (UTC) FILETIME=[39DB8250:01CE395A]
--=_4404fe2999b34dc58f10c890ae3d5e76
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1
This is a text message.
--=_4404fe2999b34dc58f10c890ae3d5e76
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1
<html><body><p>This is a html message</p></body></html>
--=_4404fe2999b34dc58f10c890ae3d5e76--
i think im not blacklisted, i've just set up this vps
any ideas what might be wrong?
thanks in advance
It's not the email library but your MX domain, mainly the fact you are missing some things. You have to setup DomainKeys / DKIM and SPF in order for your emails to be legit. And, even after you setup these, don't expect to go inbox, it will be 50/50 chances for this to happen. Email is a real nightmare nowadays.
The only reason why you go inbox right now is because your ip address is clean and did no spam, but don't expect this to last, you'll get blacklisted sooner or later.
Just a hint, you can use smth like http://mandrill.com/ (they have a nice api) for sending emails, it is free for small amount of emails and can get you going pretty fast, mostly the important thing is that you will reach the inbox everytime and you don't have to go through the nightmare called email setup.