Guest User

Untitled

a guest
Nov 2nd, 2017
924
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. if(isset($_POST['send-serial']))
  2. {
  3. add_filter( 'wp_mail_content_type', 'wpdocs_set_html_mail_content_type' );
  4.  
  5. $user_id = get_current_user_id();
  6. $user = get_userdata( $user_id );
  7.  
  8. $firstname = get_user_meta( $user_id, 'first_name', true );
  9. $lastname = get_user_meta( $user_id, 'last_name' , true );
  10. $tel = get_user_meta( $user_id, 'billing_phone' , true );
  11. $useremail = $user->user_email;
  12.  
  13. $serailProduct = $_POST['serail-product'];
  14.  
  15. $headers = array(
  16. 'From: xxxxx.xx@xxx.com',
  17. 'CC: xxxxx@gmail.com',
  18. 'CC: xxxxx@gmail.com'
  19. );
  20.  
  21. $to = array(
  22. 'xxxxx.xxxx@gmail.com'
  23. );
  24. $subject = 'Serial Number';
  25. $body = '<p>Serial Number product ' . $serailProduct . '</p>
  26. <p>Name : ' . $firstname . ' ' . $lastname . '</p>
  27. <p>Email : ' . $useremail . '</p>
  28. <p>Tel : ' . $tel . '</p>';
  29.  
  30. wc_add_notice('<strong>Success:</strong> Your Serial Product has sended ', 'inkfool');
  31. wp_mail( $to, $subject, $body, $headers );
  32.  
  33. // Reset content-type to avoid conflicts -- https://core.trac.wordpress.org/ticket/23578
  34. remove_filter( 'wp_mail_content_type', 'wpdocs_set_html_mail_content_type' );
  35.  
  36. function wpdocs_set_html_mail_content_type() {
  37. return 'text/html';
  38. }
  39. }
Add Comment
Please, Sign In to add comment