Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.23 KB | None | 0 0
  1.         <?php
  2.  
  3.             // Gets User Registration Emails 'Admin Email' email content [DEFAULT PLUGIN MESSAGE]
  4.             //$messageToBeWrapped = UR_Settings_Admin_Email::ur_get_admin_email();
  5.  
  6.             $messageToBeWrapped = new UR_Settings_Admin_Email();
  7.             //var_dump($messageToBeWrapped);
  8.             $messageToBeWrapped = $messageToBeWrapped->ur_get_admin_email();
  9.             $messageToBeWrapped = get_option( 'user_registration_admin_email', $messageToBeWrapped );
  10.  
  11.             // Still need to grab 'Email Subject' field from User Registration
  12.  
  13.             $email_heading = 'New User';
  14.             $message = $messageToBeWrapped;
  15.             $plain_text = false;
  16.  
  17.             // Get woocommerce mailer from instance
  18.             $mailer = WC()->mailer();
  19.              
  20.             // Wrap message using woocommerce html email template
  21.             $wrapped_message = $mailer->wrap_message($email_heading, $message);
  22.              
  23.             // Create new WC_Email instance
  24.             $wc_email = new WC_Email;
  25.  
  26.             // Style the wrapped message with woocommerce inline styles
  27.             $html_message = $wc_email->style_inline($wrapped_message);
  28.  
  29.  
  30.             $to = 'test@test.com';
  31.             $subject = 'Test Email Subject!';
  32.             $body = $html_message;
  33.             $headers = array('Content-Type: text/html; charset=UTF-8');
  34.            
  35.             var_dump($body);
  36.             wp_mail( $to, $subject, $body, $headers );
  37.  
  38.         ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement