View Full Version : Sending mail through loop

Johana Solendha
10-19-2004, 07:47 PM
Hello guys!

If the checkbox is checked ($massmail) the users should send the mail to all of the email adresses in the database. I think I need to loop through the emails so that the email is not treated has spam, but how do I do this?

'id' int(10) NOT NULL auto_increment,
'username' text NOT NULL,
'password' text NOT NULL,
'email' text NOT NULL,

if ($massmail == "on") {
mysql_connect($config['sql_host'], $config['sql_username'], $config['sql_password']);
$sql = mysql_query("SELECT id,username,email FROM members ");
while ($row=mysql_fetch_array($result)) {
mail('".$row['email']."', "$topic", "$message", "From: $email");
mail( "$email", "$auto_subject", "$auto_message", "$headers");
} else {

mail("$mailbox", "$topic", "$message", "From: $email");
mail( "$email", "$auto_subject", "$auto_message", "$headers");

header("location: $site_thanks");