Jump to content

How to create a script to mass email all users


scarlson

Recommended Posts

<?php

  // connect to db.

  $sql = "SELECT email FROM tbl";
  if ($result = mysql_query($sql)) {
    if (mysql_num_rows($result)) {
      while ($row = mysql_fetch_assoc($result)) {
        if (mail($row['email'],'subject','message')) {
          echo "Mail sent to {$row['email']}\n";
        } else {
          echo "Failed to send mail to {$row['email']}\n";
        }
      }
    }
  }

?>

  • 9 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.