title: Get full error message from PHPMailer Exception
body: <p>I'm using the PHPMailer Class to send the smtp mails, but i need to trace log from PHPmailerException in mysql table,</p>
  
  <p><strong>Code :</strong></p>
  
  <pre><code> $mail = new PHPMailer(true);
      try {
      $mail-&gt;Host =$dmmodel-&gt;host;
      $mail-&gt;Username= $dmmodel-&gt;username;
      $mail-&gt;Password= $dmmodel-&gt;password;
      $mail-&gt;Mailer='smtp';
      $mail-&gt;Port=$dmmodel-&gt;port;
      $mail-&gt;SMTPAuth = true;
      $mail-&gt;SMTPSecure = ($dmmodel-&gt;smtp_enableSSL==1?'ssl':($dmmodel-&gt;smtp_enableSSL==2 ? 'tls':''));
      $mail-&gt;SMTPDebug = 2;
      $mail-&gt;From = $dmmodel-&gt;email_from;
      $mail-&gt;FromName = $dmmodel-&gt;name_from;
      $mail-&gt;Subject    = $this-&gt;getContentBody($docmodel-&gt;content_subject,$docmodel-&gt;crm_base_contact_id,$_POST["taskid"],$postcode,$recall_by,$recall_dt,true);
      $mail-&gt;AddAddress($email[$i]);
      $mail-&gt;IsHTML(true); 
  }
     catch (phpmailerException $e)
      {
           $msg = "Email Delivery failed -" .  $e-&gt;errorMessage();
           echo "Email not sent";
      } 
  </code></pre>
  
  <p>Where $msg variable has only message <strong>"SMTP Error: Could not authenticate"</strong>
  but when i put alert , i am getting full message(as below) reason for this issue, </p>
  
  <p><em>SMTP -> FROM SERVER:220 smtp.gmail.com ESMTP n3sm27565307paf.13 - gsmtp
  <br />SMTP -> FROM SERVER: 250-smtp.gmail.com at your service, [122.164.189.101]
  250-SIZE 35882577
  250-8BITMIME
  250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
  250-ENHANCEDSTATUSCODES
  250-PIPELINING
  250-CHUNKING
  250 SMTPUTF8
  <br />SMTP -> ERROR: Password not accepted from server: 535-5.7.8 Username and Password not accepted. Learn more at
  535 5.7.8  <a href="https://support.google.com/mail/?p=BadCredentials" rel="nofollow">https://support.google.com/mail/?p=BadCredentials</a> n3sm27565307paf.13 - gsmtp
  <br />SMTP -> FROM SERVER:250 2.1.5 Flushed n3sm27565307paf.13 - gsmtp
  <br />Email not sent</em></p>
  
  <p>how can i store the above message in a variable ? Please can anyone help me to get this full message</p>