title: PHP mailer not working on live server
body: <p>I have a problem with my PHP mailer , PHP mailer working in my localhost but its not working on live server </p>
  
  <p>Here is my mailer.php </p>
  
  <pre><code> &lt;?php require("phpmailer/class.phpmailer.php"); // path to the PHPMailer class
  $mail = new PHPMailer();
  $mail-&gt;IsSMTP(); // telling the class to use SMTP
  $mail-&gt;Mailer = "smtp";
  $mail-&gt;Host = "ssl://smtp.gmail.com";
  $mail-&gt;Port = 465;
  $mail-&gt;SMTPAuth = true; // turn on SMTP authentication
  $mail-&gt;Username = "user@gmail.com"; // SMTP username
  $mail-&gt;Password = "pswd"; // SMTP password
  
  $mail-&gt;From = "example@gmail.com";
  $mail-&gt;AddAddress("user@gmail.com");
  
  $mail-&gt;Subject = "First PHPMailer Message";
  $mail-&gt;Body = "Youy payment received";
  $mail-&gt;WordWrap = 50;
  
  if(!$mail-&gt;Send()) {
  echo 'message not send';
  echo 'Mailer error: ' . $mail-&gt;ErrorInfo;
  } else {
  echo 'Message sent.';
  }
  ?&gt;
  </code></pre>
  
  <p>when i am running this on server its shows this error</p>
  
  <pre><code>SMTP Error: Could not authenticate. Message was not sent.Mailer error: SMTP Error: Could not authenticate.
  </code></pre>
  
  <p>Please help me</p>
  
  <p>Thanks</p>