wp_mail() transforms “-” to “–” in email subject
-
I am using the wp_mail() to send emails from a custom WordPress plugin.
I am trying to figure out why the emails sent result in some non-alphanumeric characters in the email subject being changed? For example, a subject such as “Word1 – Word2” will be received as “Word1 \– Word 2”, which doesn’t look good at all.
The code looks like this:
$subject = 'word1 - word2'; $msg = 'message'; $headers = 'Content-Type: text/html; charset=utf-8'; wp_mail('[email protected]', $subject, $msg, $headers);
The email subject shows “Word1 \– Word 2” in Gmail. I know it has to do with encoding, but does anyone know how to fix this?
Thanks!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘wp_mail() transforms “-” to “–” in email subject’ is closed to new replies.