Jump to content

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<admin@jazzdirectories.com>\n";
$header1 = "Reply To: JazzDirectories.com<admin@jazzdirectories.com>\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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.