title: PHPMailer,SMTP Error Could not connect to smtp host
body: <p>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.</p>
  
  <p>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.</p>
  
  <p>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. </p>
  
  <p>I'll explain you clearly with the code.. </p>
  
  <p>This is the  send_mail.php. "mymail" function is called from another php file. </p>
  
  <pre><code>&lt;?php
  //include phpmailer
  require_once ('class.phpmailer.php');
  function mymail($mto, $msub, $mbody, $mfrom) {
  $mail = new PHPMailer();
  $mail -&gt; IsSMTP();
  $mail -&gt; SMTPAuth = true;
  $mail -&gt; SMTPSecure = "tls";
  
  $mail -&gt; Host = "email-smtp.us-west-2.amazonaws.com";
  $mail -&gt; Username = "Provided by Amazon SES";
  $mail -&gt; Password = "Provided by Amazon SES";
  
  $mail -&gt; SetFrom("$mfrom", '');
  //from (verified email address)
  $mail -&gt; Subject = "$msub";
  $body = "$mbody";
  $body = eregi_replace("[\]", '', $body);
  $mail -&gt; MsgHTML($body);
  $mail -&gt; AddAddress("$mto", "");
  
  if ($mail -&gt; Send()) {
      return 1;
  } else {
      echo "&lt;br&gt; Mail not sent, try again!";
      return 0;
  }
  }
  ?&gt;
  </code></pre>
  
  <p>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. </p>