0

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.

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. 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. 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 1

0

You 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' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.