title: Connection failed. Error #2: stream_socket_enable_crypto(): Peer certificate with PHPMailer
body: <p>I'm using below code for sending mail. It's working fine in gmail server, but it's not working for my domain.<br>
  It's showing an error like </p>
  
  <blockquote>
    <p>Connection failed. Error #2: stream_socket_enable_crypto(): Peer certificate CN=`*.999servers.com'</p>
  </blockquote>
  
  <p>How can I solve this issue?<br>
  This is my code so far:</p>
  
  <pre><code>require("PHPMailer/src/PHPMailer.php");
  require("PHPMailer/src/SMTP.php");
  $mail = new PHPMailer\PHPMailer\PHPMailer();
  $mail = new PHPMailer\PHPMailer\PHPMailer(true);
  $mail-&gt;IsSMTP();
  $mail-&gt;SMTPDebug = 4;
  $mail-&gt;SMTPAuth = true;
  $mail-&gt;SMTPSecure = 'tls';
  $mail-&gt;Host = "mail.mydomain.in";
  $mail-&gt;Port = 587;
  $mail-&gt;IsHTML(true);
  $mail-&gt;Username = "mail";
  $mail-&gt;Password = "password";
  
  $mail-&gt;SetFrom($admin_user_mail);
  $mail-&gt;AddAddress($login_user_mail);
  $mail-&gt;AddCC($admin_user_mail);
  $mail-&gt;Subject = "Mail Subject";
  $mail-&gt;Body = "Mail Content";
  
  
  if($mail-&gt;send()) 
  {   
      echo "Mail Send";
  } else 
  {
      echo "Mail Not sent";
  }
  </code></pre>