title: Phpmailer sending attachments, but not the body
body: <p>I have a form that im trying to get emailed on submit using PHPmailer. For some reason, phpmailer is sending the attachments of the email, but not the body/message. Heres my phpmailer file..</p>
  
  <pre><code>$name = "Purchase Form";
  $email_subject = "New Purchase Ticket";
  
  $body = "geg";
  
  foreach ($_REQUEST as $field_name =&gt; $value){
  if (!empty($value)) $body .= "$field_name = $value\n\r";
  }
  $Email_to = "jonahkatz@yahoo.com"; // the one that recieves the email
  $email_from = "No reply!";
  //
  //==== PHP Mailer With Attachment Func ====\\
  //
  function SendIt() {
  //
  global $attachments,$body,$name,$Email_to,$email_subject,$email_from;
  //
  $mail = new PHPMailer();
  $mail-&gt;IsQmail();// send via SMTP
  $mail-&gt;From = $email_from;
  $mail-&gt;FromName = $name;
  $mail-&gt;AddAddress($Email_to);
  $mail-&gt;AddReplyTo($email_from);
  $mail-&gt;WordWrap = 50;// set word wrap
  $mail-&gt;IsHTML = true;
  $mail -&gt;MsgHTML($body);
  $mail-&gt;AltBody = 'to view blah';
  foreach($_FILES as $key =&gt; $file){
  $target_path = "uploads/";
  $target_path = $target_path .basename($file['name']);
  
  if(move_uploaded_file($file['tmp_name'], $target_path)) {
  echo "the file ".basename($file['name'])." has been uploaded";
  }else {
   echo "there was an error";
  }
  $mail-&gt;AddAttachment($target_path);
  }
  
  $mail-&gt;Subject = $email_subject;
  if(!$mail-&gt;Send())
  {
  }
  //
  {echo "Message has been sent";}
  
  
  foreach($_FILES as $key =&gt; $file){
  $target_path = "uploads/";
  $target_path = $target_path .basename($file['name']);
  unlink($target_path);}
  }
  
  
  SendIt();
  
  
  
  
  }
  
  
  
  
  ?&gt;
  </code></pre>
  
  <p>Any input? Thanks.</p>