title: PHP MAILER sending multiple email to one recipient
body: <p>I know it may sound like duplicate but my problems a bit different
  so i'm fetching email from my database use loop to get the data the problem was even if passing 1 email at the addaddress() function at a time all the recipient receive the same email multiple times based on the number of recipient example if my recipient is three each recipient will receive three email each this is my code:</p>
  
  <pre><code>for ($i = 0; $i &lt;= (6) - 1; $i++) {
      $q = Yii::app()-&gt;db-&gt;createcommand("select user_other_email from user_account LIMIT 6")-&gt;queryall();
      $ty = '';
      for ($b = 0; $b &lt; count($q); $b++) {
          $ty = $email = $q[$b]['user_other_email'];
          $msg = "Test this!";
          $adminemail = "email@gmail.com";
          $name=' = ?UTF-8?B?' . base64_encode($adminemail) . '?=';
          $subject = 'TEST';
          $headers = "From: $name &lt;{".$adminemail."}&gt;\r\n" . 
              "Reply-To: {$adminemail}\r\n".
              "MIME-Version: 1.0\r\n".
              'Content-type: text/html; charset=iso-8859-1' . "\r\n";
          $this-&gt;mailsend2($ty,$adminemail,$subject,$msg);
      }
  }
  </code></pre>
  
  <p>AND this is my mailer function:</p>
  
  <pre><code>public function mailsend2($to, $from, $subject, $message) {
      $mail = Yii::app()-&gt;Smtpmail;
      $mail-&gt;SetFrom($from, 'Test');
      $mail-&gt;Subject = $subject;
      $mail-&gt;MsgHTML($message);
      $mail-&gt;AddAddress($to);
      if (!$mail-&gt;Send()) {
          echo "Mailer Error: " . $mail-&gt;ErrorInfo;
      } else {
          echo "Message sent!";
      }
  }
  </code></pre>
  
  <p>really dont know what is wrong with this</p>