ninja_forms_email_admin

The Ninja Forms ninja forms email admin function.

Description

ninja_forms_email_admin(); 

Usage

  1. if ( !function_exists( 'ninja_forms_email_admin' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/deprecated.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = ninja_forms_email_admin(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/deprecated/includes/deprecated.php  
  1. function ninja_forms_email_admin() { 
  2. global $ninja_forms_processing; 
  3.  
  4. do_action( 'ninja_forms_email_admin' ); 
  5.  
  6. $form_ID = $ninja_forms_processing->get_form_ID(); 
  7. $form_title = $ninja_forms_processing->get_form_setting( 'form_title' ); 
  8. $admin_mailto = $ninja_forms_processing->get_form_setting( 'admin_mailto' ); 
  9. $email_from_name = $ninja_forms_processing->get_form_setting( 'email_from_name' ); 
  10. $email_from = $ninja_forms_processing->get_form_setting( 'email_from' ); 
  11. $email_type = $ninja_forms_processing->get_form_setting( 'email_type' ); 
  12. $subject = $ninja_forms_processing->get_form_setting( 'admin_subject' ); 
  13. $message = $ninja_forms_processing->get_form_setting( 'admin_email_msg' ); 
  14. $email_reply = $ninja_forms_processing->get_form_setting( 'admin_email_replyto' ); 
  15.  
  16. if ( $ninja_forms_processing->get_form_setting( 'admin_email_name' ) ) { 
  17. $email_from_name = $ninja_forms_processing->get_form_setting( 'admin_email_name' ); 
  18.  
  19. if ( $email_from_name AND $email_reply ) { 
  20. $email_reply = $email_from_name . ' <' . $email_reply . '>'; 
  21.  
  22. if ( !$subject ) { 
  23. $subject = $form_title; 
  24. if ( !$message ) { 
  25. $message = ''; 
  26. if ( !$email_type ) { 
  27. $email_type = ''; 
  28.  
  29. if ( $email_type !== 'plain' ) { 
  30. $message = apply_filters( 'ninja_forms_admin_email_message_wpautop', wpautop( $message ) ); 
  31.  
  32. $email_from = $email_from_name.' <'.$email_from.'>'; 
  33.  
  34. $email_from = apply_filters( 'ninja_forms_admin_email_from', $email_from, $email_reply, $form_ID ); 
  35.  
  36. $headers = array(); 
  37. $headers[] = 'From: ' . $email_from; 
  38. if( $email_reply ) { 
  39. $headers[] = 'Reply-To: ' . $email_reply; 
  40. $headers[] = 'Content-Type: text/' . $email_type; 
  41. $headers[] = 'charset=utf-8'; 
  42.  
  43. $attachments = false; 
  44. if ($ninja_forms_processing->get_form_setting( 'admin_attachments' ) ) { 
  45. $attachments = $ninja_forms_processing->get_form_setting( 'admin_attachments' ); 
  46.  
  47. if ( is_array( $admin_mailto ) AND !empty( $admin_mailto ) ) { 
  48. foreach( $admin_mailto as $to ) { 
  49. if ( $attachments ) { 
  50. wp_mail( $to, $subject, $message, $headers, $attachments ); 
  51. } else { 
  52. wp_mail( $to, $subject, $message, $headers ); 
  53.  
  54. // Delete our admin CSV if one is present. 
  55. if ( file_exists( $ninja_forms_processing->get_extra_value( '_attachment_csv_path' ) ) ) { 
  56. unlink ( $ninja_forms_processing->get_extra_value( '_attachment_csv_path' ) );