title: Stream_socket_enable_crypto(): Peer certificate CN=`*.webhostbox.net' did not match expected CN=`mail.maydomain.com' using PHPMailer
body: <p>I am using PHPMailer to send the email but I am getting an error.My domain is not SSL. If I am using smtp.gmail.com with my Gmail id then emails are going to inbox but when I am using my hosting details then I am getting an error</p>
  
  <pre><code> Warning: stream_socket_enable_crypto(): Peer certificate CN=`*.webhostbox.net' did not match expected CN=`mail.mydomain.com' in C:\xampp\htdocs\sendmail\mail\class.smtp.php on line 337
   Mailer Error: SMTP connect() failed.
  </code></pre>
  
  <p>If I set <code>$mail-&gt;SMTPSecure = 'tls';</code> to $mail->SMTPSecure = 'false'; then not getting an error but emails are going to spam.
  Even I tried below code.</p>
  
  <pre><code>$mail-&gt;SMTPOptions = array (
          'ssl' =&gt; array(
              'verify_peer'  =&gt; false,
              'verify_peer_name'  =&gt; false,
              'allow_self_signed' =&gt; true));
  </code></pre>
  
  <p>Would you help me out in this?</p>
  
  <p>Thank you</p>
  
  <pre><code>require 'mail/PHPMailerAutoload.php';
  function sendMail($subject, $content, $email){
      $phpMailerSubject = $subject;
      $phpMailerText = $content;
      $phpMailerTo = $email; 
      include 'mail/PHPMailerConfig.php';
  }
  </code></pre>
  
  <p><strong>PHPMailerConfig.php</strong></p>
  
  <pre><code>&lt;?php 
  //Create a new PHPMailer instance
  $mail = new PHPMailer;
  
  $mail-&gt;IsSMTP(); 
  $mail-&gt;SMTPDebug = 0;
  $mail-&gt;Debugoutput = 'html';
  $mail-&gt;Host = 'mail.mydomain.com';
  $mail-&gt;Port = 587;
  $mail-&gt;SMTPSecure = 'tls';
  $mail-&gt;SMTPAuth = true;
  $mail-&gt;Username = "abc@mydomain.com";
  $mail-&gt;Password = "Pass#@123";
  $mail-&gt;setFrom('abc@mydomain.com', 'naren');
  $mail-&gt;addReplyTo('abc@mydomain.com', 'naren');
  $mail-&gt;addAddress($phpMailerTo, 'Customer');
  $mail-&gt;Subject = $phpMailerSubject;
  $mail-&gt;msgHTML($phpMailerText);
  $mail-&gt;AltBody = ' ';
  
  //Attach an image file
  //$mail-&gt;addAttachment('images/phpmailer_mini.png');
  
  //send the message, check for errors
  if (!$mail-&gt;send()) { echo "Mailer Error: " . $mail-&gt;ErrorInfo;
  } else { 
  echo "sucessfully"; 
  }
  </code></pre>