title: php mailer function with multiple attachment
body: <p>I have a form which has a value <code>count</code>. I want to send mail with attachment and the attachment is as many time the <code>count</code> value is. Actually I want to send the attachment checking some factors by <code>if</code> statement, so how can I do this, please can any one help me for this?
  Here my code goes:</p>
  
  <pre><code>&lt;?php
  echo $count;
  require_once 'session.php';
  require_once('class.phpmailer.php');
  $mail = new PHPMailer(); // defaults to using php "mail()"
  $body = file_get_contents('mail.html');
  $body = eregi_replace("[\]",'',$body);
  $mail-&gt;AddReplyTo("lipsa.auroin@gmail.com","First Last");
  $mail-&gt;SetFrom('lipsa.auroin@gmail.com', 'First Last');
  $mail-&gt;AddReplyTo("lipsa.auroin@gmail.com","First Last");
  $email=$_POST['email2'];
  $addresses = explode(',', $email);
  foreach ($addresses as $address){
      $address = trim($address);
      $mail-&gt;AddAddress($address);
  }
  $mail-&gt;Subject = "PHPMailer Test Subject via mail(), basic";
  $mail-&gt;AltBody    = "To view the message, please use an HTML compatible email viewer!";
  $mail-&gt;MsgHTML($body);
  $mail-&gt;AddAttachment("pdf/report.pdf");
  $mail-&gt;AddAttachment("pdf/template.pdf");
  if(!$mail-&gt;Send()) {
      echo "Mailer Error: " . $mail-&gt;ErrorInfo;
  }
  else {
      echo "Message sent!";
  }
  ?&gt;
  </code></pre>
  
  <p>I have the <code>count</code> variable with value starting from 1 to n</p>