Status
Not open for further replies.

__Doc_

Active Member
186
2009
2
0
I need a small/quick/working php script that sends an email from emails.txt (same dir as script) only need to send about 100-200 emails once

anyone have one?
 
4 comments
use PHP Mailer, here is a small script i just wrote for you:

PHP:
// include phpmailer library, download from here http://phpmailer.worxware.com/
require("phpmailer.inc.php");

// then you need to read file, i assume there are emails in one line and you dont have names.
$emails = file('emails.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);

// Start building email
$mail = new phpmailer;
$mail->IsMail(); 

$mail->From = "youremail.com";
$mail->FromName = "Your name";
$mail->IsHTML(true);
$mail->Subject = "Your Subject";
$mail->Body = "Your message here";

// start a loop
foreach ($emails as $email) {

  if(!empty($email){
  // send email one by one
  $mail->AddAddress($email);
   $mail->Send();
   $mail->ClearAddresses();
  // lets sleep for 2 seconds before sending next email
  sleep(2);
 }
}
 
Status
Not open for further replies.
Back
Top