Automatically exported from code.google.com/p/planningalerts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 16 години
преди 16 години
преди 16 години
преди 16 години
преди 16 години
преди 16 години
преди 15 години
преди 16 години
преди 15 години
преди 16 години
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. require_once('tools_ini.php');
  3. require_once('application.php');
  4. require_once('DB.php');
  5. //initialise
  6. $news_mailer = new news_mailer();
  7. $news_mailer->run();
  8. //class
  9. class news_mailer {
  10. //Run
  11. function run (){
  12. $db = DB::connect(DB_CONNECTION_STRING);
  13. //Grab all the users
  14. $sql = "select distinct email
  15. from user
  16. where confirmed = 1";
  17. $user_results = $db->getAll($sql);
  18. print "Found " . sizeof($user_results) . " to email ";
  19. if(sizeof($user_results) > 0){
  20. //Loop though users
  21. for ($i=0; $i < sizeof($user_results); $i++){
  22. //Smarty template
  23. $smarty = new Smarty;
  24. $smarty->force_compile = true;
  25. $smarty->compile_dir = SMARTY_COMPILE_DIRECTORY;
  26. //Get the email text
  27. $email_text = $smarty->fetch(SMARTY_TEMPLATE_DIRECTORY . 'news_mail.tpl');
  28. //Send the email
  29. if($email_text !=""){
  30. //send_text_email($user_results[$i][0], EMAIL_FROM_NAME, EMAIL_FROM_ADDRESS, "PlanningAlerts needs your help", $email_text);
  31. send_text_email("testing@memespring.co.uk", EMAIL_FROM_NAME, EMAIL_FROM_ADDRESS, "PlanningAlerts needs your help", $email_text);
  32. }
  33. exit;
  34. }
  35. }
  36. }
  37. }
  38. ?>