title: i want to send email with attachments using phpmailer
body: <p>i am using phpmailler for sending mail,mail works successfully but without attachments. i want to send mail with attachments.
  i have tried this code.</p>
  
  <p>thanks in advance.</p>
  
  <pre><code>$s2="select * from tbl_new_user where login_name='".$rw['clientname']."'";
  $q2=mysql_query($s2) or die($s2);
  $row=mysql_fetch_array($q2);
  
  $s22="select * from tbl_job_schedule where clientname='".$rw['clientname']."' and jobdate='".$_SESSION['strmonth']."-".$_REQUEST['dt']."-".$_SESSION['yy']."'";
  $q22=mysql_query($s22) or die($s22);
  $row2=mysql_fetch_array($q22);  
  
  $mail = new PHPMailer;
  
  $mail-&gt;IsSMTP();                                      // Set mailer to use SMTP
  $mail-&gt;Host = 'smtpout.secureserver.net';  // Specify main and backup server
  $mail-&gt;Port = '80';
  $mail-&gt;SMTPAuth = true;                               // Enable SMTP authentication
  $mail-&gt;Username = 'username';                            // SMTP username
  $mail-&gt;Password = 'password';                           // SMTP password
  $mail-&gt;SMTPSecure = '';                            // Enable encryption, 'ssl' also accepted
  $mail-&gt;SMTPDebug = 1;
  
  $mail-&gt;From = 'abc@abc.com';
  $mail-&gt;FromName = 'abc@abc.com';
  $mail-&gt;AddAddress($row['client_email'], '');  // Add a recipient
  $mail-&gt;AddAddress($row['client_email2']);     // Name is optional
  $mail-&gt;AddAddress($row['client_email3']);
  $mail-&gt;AddAddress($row['client_email4']);
  $mail-&gt;AddAddress($row['client_email5']);
  $mail-&gt;AddAddress($row['client_email6']);
  $mail-&gt;AddReplyTo('info@example.com', 'Information');
  //$mail-&gt;AddCC('cc@example.com');
  //$mail-&gt;AddBCC('bcc@example.com');
  
  $mail-&gt;WordWrap = 50;      
                             // Set word wrap to 50 characters
  if($row2['file1']!='')
  {                          
  $mail-&gt;AddAttachment('kurtacompany/techreporting/upload/'.$row2['file1'].'');         // Add attachments
  }
  
  if($row2['file2']!='')
  {                          
  $mail-&gt;AddAttachment('kurtacompany/techreporting/upload/'.$row2['file2'].'');         // Add attachments
  }
  
  if($row2['file3']!='')
  {                          
  $mail-&gt;AddAttachment('kurtacompany/techreporting/upload/'.$row2['file3'].'');         // Add attachments
  }
  
  if($row2['file4']!='')
  {                          
  $mail-&gt;AddAttachment('kurtacompany/techreporting/upload/'.$row2['file4'].'');         // Add attachments
  }
  
  if($row2['file5']!='')
  {                          
  $mail-&gt;AddAttachment('kurtacompany/techreporting/upload/'.$row2['file5'].'');         // Add attachments
  }
  
  if($row2['file6']!='')
  {                          
  $mail-&gt;AddAttachment('kurtacompany/techreporting/upload/'.$row2['file6'].'');         // Add attachments
  }
  
  if($row2['file7']!='')
  {                          
  $mail-&gt;AddAttachment('kurtacompany/techreporting/upload/'.$row2['file7'].'');         // Add attachments
  }
  
  if($row2['file8']!='')
  {                          
  $mail-&gt;AddAttachment('kurtacompany/techreporting/upload/'.$row2['file8'].'');         // Add attachments
  }
  
  if($row2['file9']!='')
  {                          
  $mail-&gt;AddAttachment('kurtacompany/techreporting/upload/'.$row2['file9'].'');         // Add attachments
  }
  if($row2['file10']!='')
  {                          
  $mail-&gt;AddAttachment('kurtacompany/techreporting/upload/'.$row2['file10'].'');         // Add attachments
  }
  
  
  
  //$mail-&gt;AddAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
  $mail-&gt;IsHTML(true);                                  // Set email format to HTML
  
  $mail-&gt;Subject = 'Reporting';
  $mail-&gt;Body    = '&lt;p&gt;This is an automated email report for the work done today.
  
  Below are the comments showing on what we have worked,if you have any questions please go to the reporting URL provided and update your comment or can send a separate email to me directly on my email ID provided.&lt;/p&gt;
  
  
  &lt;b&gt;Work Comments : "'.$row2['client_cmnt'].'"&lt;/b&gt;';
  $mail-&gt;AltBody = '';
  
  if(!$mail-&gt;Send()) {
     echo 'Message could not be sent.';
     echo 'Mailer Error: ' . $mail-&gt;ErrorInfo;
     exit;
  }
  
  echo 'Message has been sent';
  
              echo "&lt;script&gt;window.close()&lt;/script&gt;";
  
  }
  </code></pre>