In my website i am using PHPMailer to send automatic mails to the customers. The website is hosted on GoDaddy shared hosting server and using Google Apps as mail service (myserver.com). SPF record is added with myserver.com.
Recently there were many complaints from @hotmail.com, @live.com.au, @live.co.uk, @live.com customers that they are not receiving any mails from the website.
I am using the below code to send mails
Code 1 -- With SMTP
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 0;
$mail->Host = 'localhost';
$mail->Port = 25;
$mail->SMTPSecure = 'none';
$mail->SMTPAuth = false;
$mail->setFrom('confirmation@myserver.com', 'Confirmation[My Server]');
$mail->addReplyTo('info@myserver.com', 'My Server');
$mail->addAddress($client_mailid, $client_mailid);
$mail->Subject = $client_mail_sub;
$mail->msgHTML($newbody);
//send the message
if (!$mail->send()) {
log_entry($mail->ErrorInfo, MAIL_ERR_LOG);
} else {
log_entry("Mail sent to ". $client_mailid , MAIL_GEN_LOG);
}
I have also tried the below code
Code 2 -- Without SMTP
$mail = new PHPMailer;
$mail->setFrom('confirmation@myserver.com', 'Confirmation[My Server]');
$mail->addReplyTo('info@myserver.com', 'My Server');
$mail->addAddress($client_mailid, $client_mailid);
$mail->Subject = $client_mail_sub;
$mail->Host = "myserver.com";
$mail->msgHTML($newbody);
//send the message
if (!$mail->send()) {
log_entry($mail->ErrorInfo, MAIL_ERR_LOG);
} else {
log_entry("Mail sent to ". $client_mailid , MAIL_GEN_LOG);
}
Is there any issue with my codes? If there is no issue what might be the reason for this issue?
I have searched many times to get one solution to the below issue, tried many work arounds and nothing worked for me. I am sorry if this is a repeated question.
Thank you for your help.
EDIT Added the header information
Delivered-To: abc@gmail.com
Received: by 10.96.137.33 with SMTP id qf1csp1412957qdb;
Wed, 17 Dec 2014 06:47:28 -0800 (PST)
X-Received: by 10.66.124.225 with SMTP id ml1mr5209349pab.142.1418827647092;
Wed, 17 Dec 2014 06:47:27 -0800 (PST)
Return-Path: <confirmation@myserver.com>
Received: from sg2nlshrout01.shr.prod.sin2.secureserver.net (sg2nlshrout01.shr.prod.sin2.secureserver.net. [182.50.132.193])
by mx.google.com with ESMTP id it2si5932112pbb.105.2014.12.17.06.47.24;
Wed, 17 Dec 2014 06:47:26 -0800 (PST)
Received-SPF: pass (google.com: domain of confirmation@myserver.com designates 182.50.132.193 as permitted sender) client-ip=182.50.132.193;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of confirmation@myserver.com designates 182.50.132.193 as permitted sender) smtp.mail=confirmation@myserver.com
Received: from sg2nlhg144.shr.prod.sin2.secureserver.net ([182.50.130.216])
by sg2nlshrout01.shr.prod.sin2.secureserver.net with bizsmtp
id Uen91p0094gGj8e01en9ff; Wed, 17 Dec 2014 07:47:09 -0700
Received: from www.myserver.com (localhost [127.0.0.1])
by sg2nlhg144.shr.prod.sin2.secureserver.net (8.14.4/8.12.11) with ESMTP id sBHElOQA024281;
Wed, 17 Dec 2014 07:47:24 -0700
Date: Wed, 17 Dec 2014 14:47:24 +0000
To: "Confirmation[My Server]" <confirmation@myserver.com>,
"My Server" <info@myserver.com>
From: "Confirmation[My Server]" <confirmation@myserver.com>
Reply-To: "My Server" <info@myserver.com>
Subject: XXXXXXXXXXXXXXXXXXXXXX.
Message-ID: <209589041f9f422b4a259b3796e90cbc@www.myserver.com>
X-Priority: 3
X-Mailer: PHPMailer 5.2.9 (https://github.com/PHPMailer/PHPMailer/)
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="b1_209589041f9f422b4a259b3796e90cbc"
Content-Transfer-Encoding: 8bit
--b1_209589041f9f422b4a259b3796e90cbc
Content-Type: text/plain; charset=us-ascii
To view the message, please use an HTML compatible email viewer!
--b1_209589041f9f422b4a259b3796e90cbc
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit