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

Hi,

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:

$kirby->email([
    'template' => 'email.html',
    'from'     => 'from@example.com',
    'replyTo'  => 'reply-to@example.com',
    'to'       => 'to@example.com',
    'subject'  => esc($data['pagetitle']),
    'data'     => [
        'message'   => esc($data['message']),
        'name'      => esc($data['name']),
    ],
]);

The email-output looks like this:

To: to@example.com
Subject: Event A
Date: Wed, 22 May 2019 12:30:46 +0000
From: from@example.com
Reply-To: reply-to@example.com
Message-ID: <5p5tDYEr8PLj1eyFA1iWqvmjnSogcLGZwQyesO1xdkY@localhost>
X-Mailer: PHPMailer 6.0.7 (https://github.com/PHPMailer/PHPMailer)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8

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

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.“have.to.look.it.up”.

I see. Thank you.