Jump to content

Recommended Posts

Hey I have got an email script which emails a .txt with about 282K email addresses, I now want to set a waiting time between each e-mail sent, does anyone know how to do this?

 

Thanks in advance!

 

My script:

<?php
// read the list of emails from the file.
$email_list = file("elist.txt");

// count how many emails there are.
$total_emails = count($email_list);

// go through the list and trim off the newline character.
for ($counter=0; $counter<$total_emails; $counter++) {
   $email_list[$counter] = trim($email_list[$counter]);
   }

// implode the list into a single variable, put commas in, apply as $to value.
$to = implode(",",$email_list);

$subject = "My email test.";
$message = "Hello, how are you?";

if ( mail($to,$subject,$message) ) {
   echo "The email has been sent!";
   } else {
   echo "The email has failed!";
   }
?>

Link to comment
https://forums.phpfreaks.com/topic/101588-email-script-waiting-time/
Share on other sites

holy underwear, batman! You are doing this the crazy way!

go to http://sourceforge.net/projects/mailgroup and download my mail group solution application. it sends each email as a single email to a single recipient. The RFC standards for email is no more than 300 recipients unless you are a listserv.

You have quite the newsletter!

 


<?php

// Set no max execution time
set_time_limit(0);

// read the list of emails from the file.
$email_list = file("elist.txt");

$subject = "My email test.";
$message = "Hello, how are you?";

foreach ($email_list as $email) {

if ( mail( trim($email),$subject,$message ) )
	echo "Mail sent to $email successfully<br>\n";
else
	echo "Could not send mail to $email<br>\n";

// Pause for 3 seconds
sleep(3);

}

?>

 

Keep in mind, 3 seond delay * 282k emails = almost 10 days to run the script ;)

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.