Hey guys I am trying to make an email script for my game site, but now that the member number has risen i believe it is crapping out because BCC can only fit so many into the email... How Can I make it to where I can email every player, even if there is a couple thousand people? thanks!
Coding I have so far wrote: if (isset($POST['send_mass_mail'])) { $subject = $POST['subject']; $tmessage = $_POST['message']; $sql = "SELECT `email` FROM `UserInfo`"; if ( !($result = $db->sql_query($sql)) ) { die('Failed to query database.'); } for ($i=$start;$i<$mysql_num_rows($result);$i++) { $player_email .= mysql_result($result,$i,"email") .","; } // To send HTML email, to all players in game $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: [email]admin@ultimate-battle-online.com[/email]' . "\r\n"; $headers .= 'BCC: ' . $player_email . "\r\n"; $subject = "Elemental Fury Mass Email: " . $subject; $to = "admin@ultimate-battle-online.com"; mail($to, $subject, $tmessage, $headers); }
if (isset($POST['send_mass_mail'])) { $subject = $POST['subject']; $tmessage = $_POST['message'];
$sql = "SELECT `email` FROM `UserInfo`"; if ( !($result = $db->sql_query($sql)) ) { die('Failed to query database.'); } for ($i=$start;$i<$mysql_num_rows($result);$i++) { $player_email .= mysql_result($result,$i,"email") .","; } // To send HTML email, to all players in game $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: [email]admin@ultimate-battle-online.com[/email]' . "\r\n"; $headers .= 'BCC: ' . $player_email . "\r\n"; $subject = "Elemental Fury Mass Email: " . $subject; $to = "admin@ultimate-battle-online.com"; mail($to, $subject, $tmessage, $headers);
}
here is the code for it!
-deth4uall
break it into sections of 100 people or 500 people using loops
example?
//on the first loop $offset = 0; $recordCount=500;
//if this is not the first loop you will need to start where you left off
$sql = "SELECT email FROM UserInfo limit $offset, $recordCount";
email
UserInfo