Jump to content

send email at a specific start number


coltrane

Recommended Posts

I have the following code which I want to send 100 emails at a time starting at a specific number in the list. I have a form to input the subject, content and start number. The start number aspect does not work, it always starts at 1.  Thank you for any help.

 

<?php
// Website Contact Form Generator 

include("open_db.php");


$query = "SELECT * FROM email_list LIMIT " . $_POST['start'] . "100";


$result = mysql_query($query);
if (!$result){
	die("Database Query Failed: " . mysql_error());
} else {
	$num = mysql_numrows($result);

}
$header = "From: JazzInstructors.com<[email protected]>\n";
$header1 = "Reply To: JazzDirectories.com<[email protected]>\n";

$Subject = $_POST['subject'];
$content = $_POST['content']; 


while ($row = mysql_fetch_array ($result)){
$first_name=$row['first_name'];
$last_name=$row['last_name'];
$Emailto = $row['email'];

$msg = "Dear $first_name $last_name, \n $content";


mail ($Emailto, $subject, $msg,$header );


}

include("close_db.php"); 

?>

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/174214-send-email-at-a-specific-start-number/
Share on other sites

Have you confirmed that $_POST["start"] has a value?

 

Also, unless it is in the $_POST value (unlikely) you need a comma between the offset number and the limit:

 

... LIMIT " . $_POST['start'] . ", 100";

 

Otherwise it will be read like this (eg where $_POST["start"]=20):

 

... LIMIT 20100";

 

 

Chris

not trying to discourage your mail script or anything but calling the mail() function 100+ times over and over again is just going to freeze your script/server..etc

 

Your best bet is to compile a comma separated list of 100 people at a time if not all of your users and send it all at once as a BLIND CARBON COPY -> Bcc

 

something like this

http://www.dreamincode.net/forums/showtopic99812.htm

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.