title: Bulk mail recipient issue in PHP Mailer
body: <p>I am trying to send bulk mail. And It worked but the problem is when I am checking on Gmail this shows. I can use Bcc and solve this issue but I want to for learning purposes.</p>
  <pre><code>------------------------------------------
  from:   example &lt;example@gmail.com&gt;
  to: example1@gmail.com,
  example2@gmail.com,
  example2@gmail.com
  date:   Dec 19, 2021, 1:18 AM
  subject:    Testing Mail
  mailed-by:  example
  signed-by:  example
  security:    Standard encryption (TLS) Learn more
  ---------------------------------------------
  </code></pre>
  <p>In the recipient why all subscriber's mail is showing in &quot;to&quot;. Please help me to fix it. I want to show specific subscriber mail.</p>
  <p>Here is my code</p>
  <pre><code>&lt;?php 
          if(isset($_POST['sendmail'])) {
              $status=1;
          $sql = &quot;SELECT * FROM subscribers  WHERE status=? ORDER BY id &quot;;
          $stmt = $conn2-&gt;prepare($sql); 
          $stmt-&gt;bind_param(&quot;s&quot;, $status);
          $stmt-&gt;execute();
          $result15 = $stmt-&gt;get_result();
  
              $mail = new PHPMailer;
              //$mail-&gt;SMTPDebug = 3;                               // Enable verbose debug output
              $mail-&gt;isSMTP();                                      // Set mailer to use SMTP
              $mail-&gt;Host = 'smtp.example.com';  // Specify main and backup SMTP servers
              $mail-&gt;SMTPAuth = true;                               // Enable SMTP authentication
              $mail-&gt;Username = EMAIL;                 // SMTP username
              $mail-&gt;Password = PASS;                           // SMTP password
              $mail-&gt;SMTPSecure = 'ssl';                            // Enable TLS encryption, `ssl` also accepted
              $mail-&gt;Port = 465;                                    // TCP port to connect to
              
              if (mysqli_num_rows($result15)&gt;0) {
                  while ($row = mysqli_fetch_array($result15)) {  
                      $mail-&gt;AddAddress($row['email']);  // Add a recipient 
                  }
   }
                  $mail-&gt;setFrom(EMAIL, 'example');
                  //$mail-&gt;addReplyTo(NOREPLY);
                  $mail-&gt;isHTML(true);                                  // Set email format to HTML
  
                  $mail-&gt;Subject = $_POST['subject'];
                  $mail-&gt;Body    = '&lt;div style=&quot;border:2px solid red;&quot;&gt;This is the HTML message body &lt;b&gt;in bold!&lt;/b&gt;&lt;/div&gt;';
                  $mail-&gt;AltBody = $_POST['message'];
                  if (!$mail-&gt;send()) {
                      echo 'Message could not be sent.';
                      echo 'Mailer Error: ' . $mail-&gt;ErrorInfo;
                  } else {
                      echo 'Message has been sent';
                  }
                  
  }
       ?&gt; 
  </code></pre>