WarDeities Posted January 19, 2008 Share Posted January 19, 2008 Does anyone have a quick mass mail code? I own and operate a game called War Deities! I had a code that would pull all of the email address fomr a table on my database and allow me to send everyone the same email. It looked like this, but with the actual table/colum names: <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <?php include 'xxx'; ?> <link rel="stylesheet" href="../style.css" type="text/css"> <?php if (isset($_POST['submit'])) { $subject = $_REQUEST['subject']; $message = $_REQUEST['message']; $query="SELECT xxx FROM xxx"; $result=mysql_query($query); $num=mysql_num_rows($result); $i=0; while ($i < $num) { $email=mysql_result($result,$i,"email"); mail($email, $subject, $message, "From: War Deities<webmaster@wardeities.com>\nX-Mailer: PHP/" . phpversion()); echo "Email sent to: " . $email . "<br />"; $i++; } } ?> <br /> <form name="email" action="<?=$_SERVER['email.php']?>" method="post"> Subject <br /> <input name="subject" type="text" size="50" id="subject"><br /><br /> Message <br /> <textarea name="message" cols="50" rows="10" id="message"></textarea> <br /><br /> <input type="submit" name="submit" value="Email!"> </body> </html> (xxx = information classified to www.wardeities.com) Anyways it was working fine when I only had 100 or less members now that I have over 500 emails from my players on wardeities stored in my database this code crashes every time....it'll send to the first 15-20 then Internet Explorer stops responding! On top of that I really hated this one because I had to sit there with page open as it took about 5 seconds in between each email and posted on screen that it sent it to them... Thanks in advance if anyone can help me! P.S. I hope I can say this without getting in trouble, but if someone can post a good working one that I can set up to run with a cronjob (I post and email message in the database and have the cronjob pull any existing emails every 24 hours, email them, and mark the sent) I am willing to pay a few dollars for this code via Pay Pal! Thanks Again!!! Quote Link to comment https://forums.phpfreaks.com/topic/86728-quick-mass-mail-code/ Share on other sites More sharing options...
revraz Posted January 19, 2008 Share Posted January 19, 2008 Look at PEAR::MAIL Quote Link to comment https://forums.phpfreaks.com/topic/86728-quick-mass-mail-code/#findComment-443221 Share on other sites More sharing options...
WarDeities Posted January 19, 2008 Author Share Posted January 19, 2008 huh??? Quote Link to comment https://forums.phpfreaks.com/topic/86728-quick-mass-mail-code/#findComment-443223 Share on other sites More sharing options...
revraz Posted January 19, 2008 Share Posted January 19, 2008 http://pear.php.net/package/Mail Quote Link to comment https://forums.phpfreaks.com/topic/86728-quick-mass-mail-code/#findComment-443224 Share on other sites More sharing options...
WarDeities Posted January 19, 2008 Author Share Posted January 19, 2008 I'm gonna check it out right now...if it works I'm gonna ask you for a paypal account so I can throw you something... Thanks!!! *Crosses Fingers* Quote Link to comment https://forums.phpfreaks.com/topic/86728-quick-mass-mail-code/#findComment-443225 Share on other sites More sharing options...
revraz Posted January 19, 2008 Share Posted January 19, 2008 Should be what you need, it's designed for multiple email recipients. Quote Link to comment https://forums.phpfreaks.com/topic/86728-quick-mass-mail-code/#findComment-443231 Share on other sites More sharing options...
WarDeities Posted January 19, 2008 Author Share Posted January 19, 2008 I can't find any explanation on how to install it... The download has a file [content] If I open it with dreamweaver I get a message saying: This file has no code extention and will be opened in Code View And in the file there is a part that says: require_once 'PEAR.php'; And I suppose to name the file PEAR.php, upload it and go to wardeties.com/xxx/PEAR.php Cuz there is no <?php ?> Tags anywhere in the file I downloaded... Just kinda lost on how to install it..... ??? Quote Link to comment https://forums.phpfreaks.com/topic/86728-quick-mass-mail-code/#findComment-443233 Share on other sites More sharing options...
WarDeities Posted January 19, 2008 Author Share Posted January 19, 2008 This looks a little out of my league....I can't figure out how to install it...i thought it would be something like a .php file that you change the database name, table name, and a few other small features and have it up and running in 5 mins or so...this looks like it is something that yahoo or ebay would use...can't figure it out at all....thanks for trying though :'( Quote Link to comment https://forums.phpfreaks.com/topic/86728-quick-mass-mail-code/#findComment-443242 Share on other sites More sharing options...
mmarif4u Posted January 19, 2008 Share Posted January 19, 2008 I am using the following code for at least 600 users in my db: $sql = mysql_query("SELECT nmemail FROM m_user where cdcat=3"); $result=mysql_num_rows($sql); while ($row = mysql_fetch_array($sql)) { //******************************************************************************************** if (isset($_POST['btnsave_x'])) { $msg =($_POST['message']); $subject =htmlentities($_POST['subject']); $headers = 'From:A Team <support@something.com>' . "\r\n" . 'Cc: email@yahoo.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion() ."\r\n". 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $message = " <b>Dear valued subscriber,</b><br><br> ".$msg." <br><br> For further information please contact:<br> support@something.com<br> Best regards,<br> A Team. "; $mail=mail($row['nmemail'],$subject,$message,$headers); header("Location:message1.php"); } } And its working fine. Hopefully it will give some idea. Quote Link to comment https://forums.phpfreaks.com/topic/86728-quick-mass-mail-code/#findComment-443250 Share on other sites More sharing options...
WarDeities Posted January 19, 2008 Author Share Posted January 19, 2008 Thanks....I'll try it tonight If it works I'll message you and see if you have a paypal so I can throw you a bit! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/86728-quick-mass-mail-code/#findComment-443262 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.