i need code for making a mass mailing script with which i can send more than 1 email to an email address.
here are some scripts that may help solve your problem http://www.sitescripts.com/PHP/Email_(Mailing_Lists)/
Where are the emails stored? If they are in mysql you can loop the results and send the mails out like that. Someting like. HTML Form <h4>Mass mail form</h4> <form action="" name="mass_email" method="post"> <p>Subject of Mail: <input type="text" name="subject"></p> <p>Message to Send: <input type="text" name="message"></p> <p><input type="submit" name="send" value="Send the mass mail"></p> </form> HTML: <?php if($_POST['send']) { /*** Connections Information here ***/ $result = mysql_query("SELECT * FROM email"); // gets all the emails from the db $total = @mysql_num_rows($result); // total emails in db if($total==0) echo "No emails where found"; }else{ $i=0; // loops the emails while($i<$total) { $subject = $_POST['subject']; $message = $_POST['message']; $to = mysql_result($result, $i, 'email'); mail($to, $subject, $message) or die ("Mail failed"); echo "Sent Mail to $to<br />"; $i++; } } echo "Sent $i emails in total"; } ?> PHP: I just coded that in the quick reply havent tested it but it should work fine, this is just to show you how to use mysql and php to make a simple mass mailer, you would need to make a database have the fields I made etc to get it to work.
^ The problem with that is, that your server's DNS is going to get blocked quick, if you have a lot of users or send a lot of emails. You should use a queue. Send a few mails... wait a while,... send a few more, and so on...
It was to show how you would go about doing a mass mail, I think setting stages and making it more complicated is not wise for a novice.
easiest way is to use the sleep(); function, if you sleep too much you might die sleep(1800); // delay the script for 30 minutes PHP: The harder and more efficient way is to use the sendmail or postfix server to queue the emails for you. Another way is to split up the database table into parts using SELECT * FROM emails LIMIT 0,100 SELECT * FROM emails LIMIT 100,100 SELECT * FROM emails LIMIT 200,100 ... and so on... Code (markup):