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
selecting all emails from database and sending email
Collapse
X
-
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">
<b><h2>MAILING LIST ADMIN</h2></b>
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; ?>
Comment
-
get some codes from the forgot password send to email
then change your msql query to select all emailsLDSWAPWORLD sigpic
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.
Comment
-
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 ''<p><a href="''.$_SERVER[''PHP_SELF''].''?pos=''.
$pos.''">Send to the next ''. $limit .'' entries</a></
p>'';
?>
Comment
-
Originally posted by spider View PostThanks for the sharehttp://myfacepals.com
MYFACEPALS SOCIAL NETWORKsigpic
Comment
Comment