admin管理员组文章数量:1331849
I have problem with emails in Wordpress. I have to send message with Content-Type is text/plain, but in Wordpress default Content-Type is text/html. That change chars like &
to &
.
How can I change Content-Type? Please help.
I have problem with emails in Wordpress. I have to send message with Content-Type is text/plain, but in Wordpress default Content-Type is text/html. That change chars like &
to &
.
How can I change Content-Type? Please help.
Share Improve this question edited Jul 28, 2020 at 18:22 mozboz 2,6281 gold badge12 silver badges23 bronze badges asked Jul 28, 2020 at 18:08 Hubert RębiałkowskiHubert Rębiałkowski 32 bronze badges 5- What did you find when you searched for how to do this? It seems as though a search for example 'wordpress change content-type of email' returns lots of results. If you add the code you have so far to the question it can help people in providing an answer. – mozboz Commented Jul 28, 2020 at 18:12
- search for example 'wordpress change content-type of email' returns from plain to html, that not resolve my problem. I don't have code. I use Notifications plugin. – Hubert Rębiałkowski Commented Jul 28, 2020 at 18:17
- Ah, it depends how that plugin works then. You could try to ask the authors of that plugin for help. If you know how to do it you could try adding the code from my answer to your functions.php, it may do what you want. – mozboz Commented Jul 28, 2020 at 18:53
- Your code only set header to text/plain, but message is in html. Thanks. – Hubert Rębiałkowski Commented Jul 28, 2020 at 19:02
- Then you need to change the message content to plain text... ;-) That happens by whatever writes the message, no automatic conversion can happen. – mozboz Commented Jul 28, 2020 at 19:07
1 Answer
Reset to default 0You didn't say how you're sending emails, but if you're using wp_mail
, this is how you change the type to text/plain
:
function wp_set_mail_plaintext() {
return 'text/plain';
}
add_filter( 'wp_mail_content_type', 'wp_set_mail_plaintext' );
本文标签: Send email with ContentType textplain
版权声明:本文标题:Send email with Content-Type textplain 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742225631a2436261.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论