Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. $query = $wpdb->get_results("select contact_name, email_address, password from user where activation_token is NULL");
  2.  
  3. foreach ($query as $result ) {
  4. $recipients = $result->email_address;
  5. }
  6.  
  7.  
  8. if(!empty($query)) {
  9. $boundary = uniqid('np');
  10. $from = 'mydomain';
  11.  
  12. //headers - specify your from email address and name here
  13. //and specify the boundary for the email
  14. $headers = "MIME-Version: 1.0rn";
  15. $headers .= "From: ". $from ." rn";
  16. $headers .= "To: ".$email."rn";
  17. if (isset($bcc)) {
  18. $headers .= "Bcc: ".$bcc. "rn";
  19. }
  20. $headers .= "To: ".$recipient."rn";
  21. $headers .= "Content-Type: multipart/alternative;boundary=" . $boundary . "rn";
  22.  
  23. //here is the content body
  24. $message = "This is a MIME encoded message.";
  25. $message .= "rnrn--" . $boundary . "rn";
  26. $message .= "Content-type: text/plain;charset=utf-8rnrn";
  27.  
  28. //Plain text body
  29. $message .= $text_msg;
  30. $message .= "rnrn--" . $boundary . "rn";
  31. $message .= "Content-type: text/html;charset=utf-8rnrn";
  32.  
  33. //Html body
  34. $message .= $html_msg;
  35. $message .= "rnrn--" . $boundary . "--";
  36.  
  37. $to = $name;
  38. $subject = "E-mail subject";
  39. $headers .= 'BCC: ' .$recipients. "rn";
  40.  
  41. //error_log($message);
  42. //error_log($headers);
  43.  
  44. mail('', $subject, $message, $headers);
  45. echo 'emails have been sent';
  46.  
  47.  
  48. }else{
  49.  
  50. echo 'failed';
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement