I am trying to reset password mails to client users. I am using a helper function which is called from the controller to send emails.
function submit_email($to,$subject,$message)
{
$CI = get_instance();
$CI->load->library('My_PHPMailer');
$mail = new PHPMailer();
$mail->Host = "relay-hosting.secureserver.net";
$mail->Port = 465;
$mail->SetFrom('info@domain.in', 'Saurabh Pradhan');
$mail->AddReplyTo("info@domain.in","Saurabh Pradhan");
$mail->Subject = $subject;
$mail->Body = $message;
$mail->AltBody = "Plain text message";
$destino = $to;
$mail->AddAddress($destino, "John Doe");
if(!$mail->Send()) {
$data["message"] = "Error: " . $mail->ErrorInfo;
} else {
$data["message"] = "Message sent correctly!";
}
var_dump($data);
}
Scenario 1 (Working): If the to address is my personal gmail.id eg. pradhansp@gmail.com than the email is delivered fine.
array(1) { ["message"]=> string(23) "Message sent correctly!" }
Scenario 2 (Not Working): If the to address is client domain info@domain.in than also i got the success message but mail is not delivered.
An important point here is that client domain is hosted on godaddy however for email he is using google apps for work. I already looked at the MX entries on the godaddy account and they are pointing correctly to google.
Priority | Mail Server
1 | ASPMX.L.GOOGLE.COM.