Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $query = $wpdb->get_results("select contact_name, email_address, password from user where activation_token is NULL");
- foreach ($query as $result ) {
- $recipients = $result->email_address;
- }
- if(!empty($query)) {
- $boundary = uniqid('np');
- $from = 'mydomain';
- //headers - specify your from email address and name here
- //and specify the boundary for the email
- $headers = "MIME-Version: 1.0rn";
- $headers .= "From: ". $from ." rn";
- $headers .= "To: ".$email."rn";
- if (isset($bcc)) {
- $headers .= "Bcc: ".$bcc. "rn";
- }
- $headers .= "To: ".$recipient."rn";
- $headers .= "Content-Type: multipart/alternative;boundary=" . $boundary . "rn";
- //here is the content body
- $message = "This is a MIME encoded message.";
- $message .= "rnrn--" . $boundary . "rn";
- $message .= "Content-type: text/plain;charset=utf-8rnrn";
- //Plain text body
- $message .= $text_msg;
- $message .= "rnrn--" . $boundary . "rn";
- $message .= "Content-type: text/html;charset=utf-8rnrn";
- //Html body
- $message .= $html_msg;
- $message .= "rnrn--" . $boundary . "--";
- $to = $name;
- $subject = "E-mail subject";
- $headers .= 'BCC: ' .$recipients. "rn";
- //error_log($message);
- //error_log($headers);
- mail('', $subject, $message, $headers);
- echo 'emails have been sent';
- }else{
- echo 'failed';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement