Advertisement
towfiqi

core.php

Jun 9th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. if(!function_exists( 'optimizer_send_message' ) ){
  2. function optimizer_send_message($to) {
  3.  
  4. if (isset($_POST['contact_message'])) {
  5. add_filter('wp_mail_content_type', 'optimizer_contact_mail_type' );
  6. $to = optimizer_contact_widget_email();
  7. $to = explode(",",$to);
  8.  
  9. $subject = get_bloginfo('name')." | ". esc_html($_POST['contact_subject']);
  10. if (isset($_POST['contact_extra'])) {$extra_field = ' / '.esc_html($_POST['contact_extra']); }else{$extra_field = '';}
  11.  
  12.  
  13. ob_start();
  14. echo '<p style="border-bottom: 1px solid #DADADA;padding-bottom: 15px;"><b>From:</b> '.esc_html($_POST['contact_name']).' / '.sanitize_email($_POST['contact_email']).''.$extra_field.' <br></p>';
  15. echo wp_kses(wpautop($_POST['contact_message']));
  16.  
  17. $message = ob_get_contents();
  18.  
  19. ob_end_clean();
  20.  
  21. //$mail = wp_mail($to, $subject, $message, $headers);
  22. foreach($to as $email_address)
  23. {
  24. $headers = "From: ".sanitize_email($email_address)." <".sanitize_email($email_address).">\r\nReply-To:".sanitize_email($_POST['contact_email']);
  25. wp_mail($email_address, $subject, $message, $headers);
  26. }
  27. //if($mail){
  28. echo 'success';
  29. //}
  30. remove_filter('wp_mail_content_type', 'optimizer_contact_mail_type' );
  31. }
  32.  
  33. exit();
  34.  
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement