• I believe there is a bug in wp-mail-api.php line 381. The Content-Type header will never be set because it’s removed from the $headers array earlier on and the isset($headers['Content-Type']) check will always return false.

    // Set the content-type and charset
    $charset = apply_filters('wp_mail_charset', $charset);
    if (isset($headers['Content-Type'])) {
        if (!strstr($headers['Content-Type'], 'charset')) {
            $headers['Content-Type'] = rtrim($headers['Content-Type'], '; ') . "; charset={$charset}";
        }
    }

    I’m trying to set the content type to text/html; charset=UTF-8 but the email is being delivered with text/html; charset=ascii – I presume Mailgun server is automatically adding the header but with the wrong charset.

    • This topic was modified 1 year, 11 months ago by brettwhiteman.
  • The topic ‘Content-Type header not being set’ is closed to new replies.