title: AddStringAttachment with PDF in PHPMailer not work
body: <p>I had used phpmailer for send email. Now i have to attach pdf file in email. It attached pdf but that pdf could not open. and is shows there is problem in format. Is AddStringAttachment doesn't work for pdf? What should i do?   </p>
  
  <pre><code>require_once('././php_mailer/class.phpmailer.php');
  $this-&gt;load-&gt;helper('mail_html');
  $body2 = "You are receiving this email because the Transfer Application submitted for  transferring to g is missing required documentation. 
  Please see the note below for details. The transfer application will not be reviewed until all of the necessary materials are received by the UHSAA.
  
  ";
  $body = 'test';
  
  
  $mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
  
  $mail-&gt;IsSMTP(); // telling the class to use SMTP
      try {
          $mail-&gt;Host       = 'smtp.gmail.com'; // SMTP server
          $mail-&gt;SMTPDebug  = 0;                     // enables SMTP debug information (for testing)
          $mail-&gt;SMTPAuth   = true;                  // enable SMTP authentication
          $mail-&gt;SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
          $mail-&gt;Host       = 'smtp.gmail.com'; // sets the SMTP server
          $mail-&gt;Port       = 465;                    // set the SMTP port for the GMAIL server
          $mail-&gt;Username   = 'nabina.smartmobe@gmail.com'; // SMTP account username
          $mail-&gt;Password   = '*******';        // SMTP account password
          $mail-&gt;AddAddress('nabina.shahi@gmail.com','nabina');
  
          $mail-&gt;SetFrom('no-reply@nayacinema.com.np', 'no-reply@nayacinema.com.np');
          $mail-&gt;AddReplyTo('no-reply@nayacinema.com.np', '');
          $mail-&gt;IsHTML(true);
          $mail-&gt;Subject ='NayaCinema: Test';
          $mail-&gt;AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
          $mail-&gt;MsgHTML($body);
          $mail-&gt;AddStringAttachment($body2, 'Filename.pdf', 'base64', 'application/pdf');
  
  
      if($mail-&gt;Send()){
          echo 'sent'; die;
          return true;
      }else{
          echo ' not sent'; die;
          return false;
      }   
  } catch (phpmailerException $e) {
      echo $e-&gt;errorMessage(); //Pretty error messages from PHPMailer
  } catch (Exception $e) {
      echo $e-&gt;getMessage(); //Boring error messages from anything else!
  }
  </code></pre>
  
  <p>Thank you</p>