I am using CRED form to apply reservation for a custom post type which holds event information.
When this CRED form is submitted, it sends emails to site admin and the form submitter.
Unfortunately, there are some user who still cannot receive html emails.
Currently this is solved by sending plain text emails.
So I am wondering if there is any method to send an hybrid html and plain text email here via CRED?
Thanks for advance.
There's nothing built-in to CRED that will allow you to do this from wp-admin, but you may be able to do it with some custom code. We offer the CRED API method cred_mail_header, where you can manipulate the email headers sent with each notification: https://toolset.com/documentation/programmer-reference/cred-api/#cred_mail_header
I think you may be able to set up two different notifications, and modify the headers of one to be plain text:
Content-type: text/plain;charset=utf-8
Thank you, for your fast response!
Actually I have seen this "cred_mail_header" CRED API before. And thanks for this hint too.
However, there is another problem I am worried about:
The mail content which we input in the "notifications" rule regular text editor is automatically translate all line-breaks into <p> and <br> tags, as usual WP do.
So that even I set an header via cread_mail_header the content decorated with HTML will be sent as plain text.
I don't think, toolset CRED is smart enough for this case to strip tags before sending email with plain-text header.
Kanchun
Wow,
I didn't know that! This "wpv-noautop" could help me in other problems too.
Thank you!
I have 2 problems using this [wpv-noautop] .
1. Even if I wrap this [wpv-noautop] from start to end within the email notification,
of course CRED does not add <p>s, but it adds <p> again from outside of total block.
2. Another problem is, I don't know how to plain line breaks (like, \n) within the paragraphs
and field values.
Thanks in advanced!
Kanchun
Okay I see what you mean. Let me ask my 2nd tier support team for some additional information about this. Please stand by and I will update you when I have some more information to share.
It turns out that the email notification contents are not filterable at this time, meaning that there is no way to execute some PHP code that will strip HTML tags, or insert extra line breaks as needed, or add boundaries to the content sections. So even though the header can be changed, it's not really possible to make the necessary adjustments to the body of the email. We have a feature request to extend the functionality of the email notification editor, so that it would be possible to edit the notification with Content Templates. That would open up the possibility of filtering the message before it gets sent, which could give you the ability to send a plain-text only email. I have added this ticket to that feature request and noted your vote for this feature, but at this time I do not have a timeline for implementation.