I have a simple member management on my site. It is based on the php session. Where users can login, change password, request for a new password, logout. All of these functions works well when I perform in my PC. Request for a new password works fine and mail sent successfully, new password is received in mail.
If I try to request for a new password in mobile(iPhone) (Opened the website through local ip) I get the following error SMTP Error Could not connect to smtp host Mail not sent, try again!. But, when i do the same in my PC mail was sent successfully. When I try in samsung mobile (S4), it works sometime and sometimes error.
mymail function receives the to address, subject, message and from address from a call in other php file. Message contains the username and new password, and it is html code.
I'll explain you clearly with the code..
This is the send_mail.php. "mymail" function is called from another php file.
<?php
//include phpmailer
require_once ('class.phpmailer.php');
function mymail($mto, $msub, $mbody, $mfrom) {
$mail = new PHPMailer();
$mail -> IsSMTP();
$mail -> SMTPAuth = true;
$mail -> SMTPSecure = "tls";
$mail -> Host = "email-smtp.us-west-2.amazonaws.com";
$mail -> Username = "Provided by Amazon SES";
$mail -> Password = "Provided by Amazon SES";
$mail -> SetFrom("$mfrom", '');
//from (verified email address)
$mail -> Subject = "$msub";
$body = "$mbody";
$body = eregi_replace("[\]", '', $body);
$mail -> MsgHTML($body);
$mail -> AddAddress("$mto", "");
if ($mail -> Send()) {
return 1;
} else {
echo "<br> Mail not sent, try again!";
return 0;
}
}
?>
And, yes I am sending mail from and to the verified email in Amazon SES. I have tryed to edit the php code. Removed the sha1 function from other php file and no use. I think the problem is in this function.Generally php is server side, but, will the php processor works differently when accessed from mobile or pc? I've been trying from yesterday night. Done enough research in google. Thanks in advance.