Plain-Text Emails
-
Is there something new on this: https://wordpress.org/support/topic/sent-notifications-as-plain-text/
I’d need to send Plain-Text Email to an Server which will automatically parse the email.
But it’s a MUST, that the EMail is Plain-Text utf8.How can I archive this?
The page I need help with: [log in to see the link]
-
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?
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”:
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 installationKind regards,
AdamOk, thanks a lot for the answer. I’ll try this.
@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.
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,
AdamUnfortunately 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: 8bitMy 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.
Hello @rethus !
Please try this snippet: https://wordpress.stackexchange.com/a/371961
You can edit it to send
text/plain; charset=UTF-8as well if needed.
Warm regards,
PawelHello @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 -
This reply was modified 3 years, 9 months ago by
The topic ‘Plain-Text Emails’ is closed to new replies.