Jump to content

sending message to every 1 in my db


runnerjp

Recommended Posts

how could i send a prive message to every 1 in my db?

 

so $reciever = everyone

 

//Select the "email" column from the table or whatever you named it

$query = "SELECT email from Table";

 

//Then loop through all emails while there are emails to loop through

$result = mysql_query($query) or die("Error in query: $query. ".mysql_error());

while ($row = mysql_fetch_assoc($result))

{

// create the email function

   $email = $row['email'];
    echo "$email<br />";
    $headers .= "Bcc: $email\n";
}

 

 

or somethign to that effect

maybe do this instead of what i said for the last part in my first response

 

// parts of the email you might want to add

$to = $row[$row_email];
$subject "WHATEVER YOU WANT";
$header = "From: $from (Need to define this variable)";
$body = "what you want to say\n";

 

//mail function to send it off

mail($to, $subject, $body, $header);

well if you are only sending a couple of emails then your script will process it in time but if you have like hundreds or thousands of emails, you're script is going to timeout because it will take too long to send all those emails.  So you would break the email list down into smaller chunks and send them 1 chunk at a time.

well if you are only sending a couple of emails then your script will process it in time but if you have like hundreds or thousands of emails, you're script is going to timeout because it will take too long to send all those emails.  So you would break the email list down into smaller chunks and send them 1 chunk at a time.

 

oh ok i get what you mean do it for like 5 rows at a time and repeat

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.