Email-engine produces content-type: text/plain in HTML-Emails


I’m using the built-in email-engine to confirm event-registrations. While the emails get rendered correcty using the html-template, the content-type in the header says “text/plain”. Consequently, email-clients display the html-code in plain text instead of interpreting it.

This is the script:

    'template' => 'email.html',
    'from'     => '',
    'replyTo'  => '',
    'to'       => '',
    'subject'  => esc($data['pagetitle']),
    'data'     => [
        'message'   => esc($data['message']),
        'name'      => esc($data['name']),

The email-output looks like this:

Subject: Event A
Date: Wed, 22 May 2019 12:30:46 +0000
Message-ID: <5p5tDYEr8PLj1eyFA1iWqvmjnSogcLGZwQyesO1xdkY@localhost>
X-Mailer: PHPMailer 6.0.7 (
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8

<!doctype html>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <h1>Hi srgdhf</h1>

Maybe I’m just missing something?

Thank you.

This should be just email, not email.html. Where did you find the information to add an extension? Can’t find that anywhere in the docs.

Ah, yes, now it works. Thank you very much, Texnixe!
You’re right, the extension is neither in the docs nor the forum posts I read. I think, at a certain point I tried to specifically address the html-template – fruitless, of course –, then it must have slipped my attention.

If you want to send an html email only, just don’t put a plain text version into the /templates/emails folder. It is no longer required since version 3.1.“”.

I see. Thank you.