• Resolved MasterRed

    (@masterred)


    I need to differentiate the notification email sent to only users with a custom html template (header and footer). In my custom plugin I add this code:

    add_filter ("wp_mail_content_type", "contact_mail_content_type");
        function contact_mail_content_type() { return "text/html"; }
    
        function custom_ninja_forms_email_user(){
        global $ninja_forms_processing;
        if( 1 == $ninja_forms_processing->get_form_ID() ) {
    
        ob_start();
    	include("email_header.php");
    	?>
    	<div>MY_MESSAGE</div>
    	<?php
    	include("email_footer.php");
    	$message = ob_get_contents();
    	ob_end_clean();
    
    	$ninja_forms_processing->update_form_setting( 'email_message', $message );
       }
    }
    
    add_action( 'ninja_forms_email_user', 'custom_ninja_forms_email_user');

    Is there a way to make it work ?
    Is there a specific hook for email_user ?

    Thanks

    https://ww.wp.xz.cn/plugins/ninja-forms/

The topic ‘Custom $message for user email’ is closed to new replies.