Support » Plugin: Forminator - Contact Form, Payment Form & Custom Form Builder » HTML email code stripped from html, head and body

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Prathamesh – WPMU DEV Support

    (@wpmudev-support7)

    Hello @therealshadowhunter,

    I’m afraid there is no direct way to achieve this as of now. We use wp_kses_post to escape the HTML body which should be sanitizing it. Now looking at your scenario, I have a few options. Let me take you through it one by one.

    1. Use the Email Templates option from the Branda Plugin which would affix a permanent email template to all the email communication happening over the site.
    https://wordpress.org/plugins/branda-white-labeling/

    2. You can style the content being sent from the form to email over the email templates too. Centring text or turning it into bold using the strong tag can be done.

    3. Now if you would like to filter the content from Forminator template, you can try to use a filter forminator_custom_form_mail_before_send_mail and filter it the way you like.

    Going further, we do have a feature request to have advance HTML templates with Forminator email templates and also requests to have options to build it from scratch. I have added your vote for the same too.

    Should you have any doubts or need any help, please let us know and we would be happy to help.

    Thank you,
    Prathamesh Palve

    Thread Starter therealshadowhunter

    (@therealshadowhunter)

    Hello Prathamesh,

    Thank you so much for your prompt feedback.

    Oh no, I was hoping that a similar method would be available as applied by Ultimate Member.

    I prefer not using another plugin as my site is bloated as it is and I have no experience whatsoever on how to use “forminator_custom_form_mail_before_send_mail”

    What about:

    1. Can I change the Forminator source file not to use “wp_kses_post” so it will not sanitize? (I know it will be overwritten by an update but once stored in the database I probably will not touch the email template again”

    2. Or, can U paste the email template directly to the database (or file)? Would that be an option? I understand this will be overwritten if I use the editor again. If it is possible, where is it stored? (I looked into the tables but could not find it)

    I hope one of the above can work as a work around?

    I really want to continue using Forminator but I need to sent out HTML emails.

    Again, thank you for your strong support.

    With best regards,

    TheRealShadowHunter

    Thread Starter therealshadowhunter

    (@therealshadowhunter)

    Hi,

    A quick update for those who might be interested in the topic.

    Success, I managed to sent out an HTML-email complete with <head>, <body> and <html> tags via Forminator.

    1. Query “wp_postmeta” with “meta_key”: “forminator_form_meta”, in the “meta_value” you will find complete serialized form. Near the end you will find the email actions.

    2. Count the amount of characters of your HTML email template (I use NotePad++)

    3. Edit (*) replace the default Forminator email message by simply pasting your complete HTML-email template into the serialized string

    4. Adjust the character count to match the amount of characters of you template.In my case there are 20289 characters, thus s:20289:"<HTML TEMPLATE CODE HERE>";

    (*) For some reason I had to edit the meta_value directly in TOAD (mysql database tool) since copy/pasting the serialization string somehow broke it. I supose due to character convertion or some weird stuff being added or altered.

    Note that making any changes to the form via the UI hereafter will break the HTML email template again by sanitizing it.

    Of course, this workaround is far from ideal and I really hope a better solution will emerge.

    Thank you for your feedback.

    With best regards,

    TheRealShadowHunter

    Thread Starter therealshadowhunter

    (@therealshadowhunter)

    I guess I can mark this as solved for now? Still hoping for a better solution though 😉

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @therealshadowhunter

    About the:

    forminator_custom_form_mail_before_send_mail

    You can find the options to create a custom action on

    /forminator/library/modules/custom-forms/front/front-mail.php:150

    /**
    * Action called before mail is sent
    *
    * @param Forminator_CForm_Front_Mail - the current form
    * @param Forminator_Custom_Form_Model - the current form
    * @param array                       $data  - current data
    * @param Forminator_Form_Entry_Model $entry - saved entry @since 1.0.3
    */
    do_action( 'forminator_custom_form_mail_before_send_mail', $this, $custom_form, $data, $entry );

    Are you using the plugin option only to edit the email template?

    If so, had you tested our Branda plugin?
    https://wordpress.org/plugins/branda-white-labeling/

    It allows you to create a nice layout style for your emails, on Branda > Emails > Template.

    Best Regards
    Patrick Freitas

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘HTML email code stripped from html, head and body’ is closed to new replies.