Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter rethus

    (@rethus)

    I’ve found that Forminator has an API, but I can’t see how to archive a workflow to implement it.

    Means if I press the “Submit-Button” in the form, (i think) WP should use a hook to handle this request with own coded function.

    Any suggestions where to start with this?

    Plugin Support Laura – WPMU DEV Support

    (@wpmudev-support8)

    Hi @rethus

    I hope you’re well today!

    Forminator should already be using “Text UTF8” plain text format out of the box, unless “something” on site is forcing other content type. This is common e.g. if there’s some plugin used to “style” e-mail messages – for example to wrap them all in a custom template.

    But Forminator itself sets the plain UTF 8 text “content-type”:

    2022-07-11_13-47-43

    However, the content of the message does use HTML tags indeed. To remove those and change the message body to a real “plain text” you can add this code to the site as MU plugin:

    <?php 
    
    add_filter( 'forminator_custom_form_mail_admin_message', 'wpmudev_forminator_plain_mail', 11, 1);
    
    function wpmudev_forminator_plain_mail( $msg ) {
    	
    	$msg = wp_strip_all_tags( $msg );
    	
    	return $msg;
    	
    }

    – create an empty file with a .php extension (e.g. “forminator-plain-text-mail.php”)
    – copy and paste this code into it
    – save file and upload it to the “/wp-content/mu-plugins” folder of your site’s WordPress installation

    Kind regards,
    Adam

    Thread Starter rethus

    (@rethus)

    Ok, thanks a lot for the answer. I’ll try this.

    Thread Starter rethus

    (@rethus)

    @wpmudev-support8 can you give me a hint, where I can found all available hooks that exist for forminator?

    You used the “forminator_custom_form_mail_admin_message”, but I didn’t find this anywhere in the Documentation.

    Plugin Support Laura – WPMU DEV Support

    (@wpmudev-support8)

    Hi @rethus

    There isn’t any publicly available and up to date list of all the hooks available, I’m afraid.

    There’s documentation (which you already know) for Formiantor-specific API but that’s a bit different.

    As for hooks, the best way at the moment is to just do a full-text search for

    apply_filter

    and

    do_action

    on plugin files. The first one would be for filter hooks and the second one for action hooks. Most of them are at least basically described in code comments.

    Note though: looking for very “specific” hook by hook name in code may not always be successful because some of the hooks are using “dynamic” names. For example, hook like

    forminator_form_before_save_entry

    wouldn’t find it even though this hook exists. It’s because in code it’s defined in a dynamic way where instead _form_ part there’s a reference to a certain PHP class property which is “on the go” replaced with module type name when code is executed. This way we can use “singel hook” for forms, polls and quizzes (since it’s callback function would be the same in each case) instead of unnecessarily multiplying the same functions and hooks over and over again.

    I’m aware that this may sound a bit complex but I just wanted to let you know.

    To recap: to find all hooks you’d best just run full text search on plugin files as explained earlier above.

    Kind regards,
    Adam

    Thread Starter rethus

    (@rethus)

    Unfortunately Forminator seems not to send plain-text mail as expected.
    The Content-Type is still HTML:

    That’s part of the mail I’ve received:

    X-Mailer: WPMailSMTP/Mailer/mail 3.4.0
    MIME-Version: 1.0
    Content-Type: text/html; charset=UTF-8
    Content-Transfer-Encoding: 8bit

    My last issue to solve is how to force the mailer to have “Content-Type text/plain”

    • This reply was modified 3 years, 9 months ago by rethus.
    Plugin Support Imran – WPMU DEV Support

    (@wpmudev-support9)

    Hello @rethus !

    Please try this snippet: https://wordpress.stackexchange.com/a/371961

    You can edit it to send

    text/plain; charset=UTF-8

    as well if needed.

    Warm regards,
    Pawel

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @rethus ,

    We haven’t heard from you for some time now, so it looks like you don’t have any more questions for us.

    Feel free to re-open this ticket if needed.

    Kind regards
    Kasia

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Plain-Text Emails’ is closed to new replies.