title: Sending Multiple Mails In PHP Mailer
body: <p>I have been writing a trigger that mails an email using PHP mailer. The problem with the code is that it is sending multiple mails to a single recipient. I even tried using the <code>function singleTo</code> but even that didn't seem to work. </p>
  
  <pre><code>$mail = new PHPMailer();
  
  for($i = 0; $i &lt;= sizeof($emailid); $i++)   {
      $mail-&gt;WordWrap = 50;                              
      $mail-&gt;IsHTML(true);                                 
      $mail-&gt;SingleTo = true;
      $mail-&gt;AddAddress($emailid[$i],$name[$i]);
      $mail-&gt;Subject = 'Some Subject';
      $mail-&gt;Body    = "Some Body";
      $mail-&gt;AltBody = "Some Body";
  
      $errornumber[$i] = 1;
  
      if(!$mail-&gt;Send()) {
         $errorinfo[$i] = $mail-&gt;ErrorInfo;
         $errornumber[$i] = 0;
      }
  }
  </code></pre>