selecting all emails from database and sending email

Started on the old forum in October 2009 · view the original in the archive · old links redirect here

13 replies · 1,006 views · started 17 years ago · 1 min read

6 participants
Dhruva7 Junior · 33 posts #1

Hello friends can you please give me any script that selects all emails from your lava database and sends email to all users . Please help me with this script . Its very urgent i tried to code myself but none worked. Help me friends

Dhruva7 Junior · 33 posts #3

i have this script which also sends email after selecting all emails from your database but its not working for me its showing response error . So please can you correct the code blackhawk mate

<?php include("dbconnection.php"); if (!isset($_POST[''submit''])): ?> <html> <head> <title>Mailing List</title> </head> <body> <form method="post" action="<?=$_SERVER [''PHP_SELF'']?>"> <table align="center" bgcolor="#D6DEE7" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="center"> **<h2>MAILING LIST ADMIN</h2>** Send message to: <select name="to" size="1" style="background- color: #F7F7F7"> <option selected value="all">Entire list <option value="notall">By country </select> Country: <select name="country" size="5"> <OPTION value="Argentina">Argentina <OPTION value="Bolivia">Bolivia <OPTION value="Brazil">Brazil <OPTION value="Chile">Chile <OPTION value="Colombia">Colombia <OPTION value="Costa Rica">Costa Rica <OPTION value="Ecuador">Ecuador <OPTION value="Guatemala">Guatemala <OPTION value="Honduras">Honduras <OPTION value="Mexico">Mexico <OPTION value="Nicaragua">Nicaragua <OPTION value="Panama">Panama <OPTION value="Paraguay">Paraguay <OPTION value="Peru">Peru <OPTION value="Puerto Rico">Puerto Rico <OPTION value="Rep. Dominicana">Rep. Dominicana <OPTION value="Uruguay">Uruguay <OPTION value="Venezuela">Venezuela </select> Title or Subject: <input name="subject" type=text maxlength=100 size=40> Message: <textarea wrap name="message" rows=10 cols=45></textarea> <input type=submit name="submit" value="SUBMIT"> </td> </tr> </table> </form> </body> </html> <?php else: $to = $_POST[''to'']; $subject = $_POST[''subject'']; $message = $_POST[''message'']; $country = $_POST[''country'']; if ("all" == $to) { $x = 1; $hold = 50; // quantity of emails sent before 3 sec delay $emails = mysql_query("SELECT email FROM members"); while ($sendemail = mysql_fetch_array ($emails)) { $email = $sendemail["email"]; mail($email, $subject, $message, "From:Your name <you@whatever.com>"); $x++; if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; } } // end of while loop } else { $bycountry = mysql_query("SELECT email FROM members WHERE country = ''$country''"); while ($countmail = mysql_fetch_array ($bycountry)) { $email = $countmail["email"]; $okemail = mail($email, $subject, $message, "From:Your name <you@whatever.com>"); $x++; if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout sleep(3); $x = 0; } } // end of while loop } ?> <html> <head> </head> <body> SUCCESS! </body> </html> <?php endif; ?>
capofret Developer · 225 posts #4

get some codes from the forgot password send to email

http://coding-talk.com/f16/lavalair-forgot-password-3685/index2.html

then change your msql query to select all emails

LDSWAPWORLD site closed. im busy with other things in life like facebook , send me PM so i can add you 🙂 www.pinoySG.com

don't ask for help if you're not even helping yourself! i am tired of seeing the line "best site", i want to see something NEW and UNIQUE. maybe if i find one, ill go back to my wap life again.

External image (may be gone)

Dhruva7 Junior · 33 posts #5

wow cool idea mate 🙂

Dhruva7 Junior · 33 posts #6

well that idea is not going to work lol. Blackhawk mate please help me, i tried to spam code but that is giving unknown reply after uploading it

blackhowk Senior · 411 posts #7

hello, i dnt know nthng about lava variables:( my snippet is just a idea about sending emails. you must adapt with your hands this or try to select emails with LIMIT 1 by status ON and deliver one by one(of corse insert status row on or of)

Dhruva7 Junior · 33 posts #8

so was that script was working for you without any error blackhawk mate because i am getting reply unknown.

Dhruva7 Junior · 33 posts #9

here is my script can you please try to help what wrong with this script that i am getting unknown reply with this too mate

<?php set_time_limit(0); ignore_user_abort(); mysql_connect( "database hostname" , "username" , "*****" ); mysql_select_db( "...." ); echo ''Database connected...''; $limit = 250; //however many emails you want to send at a time $pos = $_GET["pos"]; if(empty($pos)) { $pos = 0; } if ($pos == 0) { $sql = "SELECT email FROM users LIMIT 100"; } else { $sql = "SELECT email FROM users LIMIT "; $sql .= $pos; $sql .= '', ''; $sql .= $limit; } $result = mysql_query($sql); while($user = mysql_fetch_assoc($result)) { $email = $user[''email'']; mail($email , "...." , $body , "..."); echo $email; } $pos =$pos + $limit; echo '' <a href="''.$_SERVER[''PHP_SELF''].''?pos=''. $pos.''">Send to the next ''. $limit .'' entries</a></ p>''; ?>
blackhowk Senior · 411 posts #12

you can' t send 50emails on each 3sec! that means 1000 per min?! most common servers don' t accept more than 200 per min. anyway if you want to send more than two you must respect the comma. ' ; ' ex: you@you.com; you@me.com; you@us.com; etc. try to print the result first.

WhiteWarrior Principal · 1,419 posts #13

This is pointless!! all its doing is sending spam mail, like blackhowk said most common servers don' t accept more than 200 per min. and imagine having about 10,000 members and sending emails to all, it will kill the server! i don't think any host will allow this on the servers.

Dhruva7 Junior · 33 posts #14

well i created my script for to use emails stored in database to send all of them emails , i have about 1800 emails stored so i sent them emails And its worked for me

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close