Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. <?php
  2. // read the list of emails from the file.
  3. $email_list = file("elist.txt");
  4.  
  5. // count how many emails there are.
  6. $total_emails = count($email_list);
  7.  
  8. // go through the list and trim off the newline character.
  9. for ($counter=0; $counter<$total_emails; $counter++) {
  10. $email_list[$counter] = trim($email_list[$counter]);
  11. }
  12.  
  13. // implode the list into a single variable, put commas in, apply as $to value.
  14. $to = implode(",",$email_list);
  15.  
  16. $subject = "TEST";
  17. $message = "TEST";
  18. $headers = 'From: TEST <TEST@gmail.com>' . "rn";
  19.  
  20. if ( mail($to,$subject,$message,$headers) ) {
  21. echo "The email has been sent!";
  22. } else {
  23. echo "The email has failed!";
  24. }
  25. ?>
  26.  
  27. $subject = "TEST";
  28. $message = "<html><body><p>Text</p></body></html>";
  29.  
  30. $headers = 'From: TEST <TEST@gmail.com>' . "rn";
  31. // To send HTML mail, the Content-type header must be set
  32. $headers .= 'MIME-Version: 1.0' . "rn";
  33. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
  34.  
  35. $html = <<<MSG
  36. <html>
  37. <head>
  38. ....
  39. </head>
  40. <body>
  41. <h2> text title </h2>
  42. <span>$variable</span>
  43. ....
  44. </body>
  45. </html>
  46.  
  47. MSG;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement