Umlaute in E-Mail subject

When using Umlaute in the Body all is working fine. But when using in the Subject I get wired characters. Is there any trick to avoid this?

On Discord, you wrote that you tried multiple solutions. Would be interesting which ones so that we don’t have to look into the same stuff again?

1 Like

I remember this issue. I remember it happened to me on projects other than Kirby. I don’t know the source of the problem but I can suggest a solution:

Try encoding your subject variable as follows:

$subject = '=?UTF-8?B?'.base64_encode($subject).'?=';



@texnixe @byybora This is really all a bit strange. I have also tested various Base64 encodings, escape methods, all known field methods etc. and all without success. What I find particularly strange which I also noticed: the method of byybora I have also found on the net in relation to the PHP mailer. But it only works when I work without variables.

// BTW; $title contains a lot of Umlaute


'subject' => '=?UTF-8?B?' . base64_encode('Ihre Anfrage zur ' . $titel . ' am ' . $datum . ' um ' . $uhrzeit . ' Uhr') . '?=',


'subject' => '=?UTF-8?B?' . base64_encode("Ihre Anfrage zur " . $titel . " am " . $datum . " um " . $uhrzeit . " Uhr") . '?=',


'subject' => '=?UTF-8?B?' . base64_encode("ÄäÜüÖö") . '?=',

you sure, that the entered signs are utf-8 encoded? maybe browser send other encoding?
in here umlauts are working fine via variable…

so check the string… what is realy stored into? =)

Ok things getting strange. I now deleted the string and typed character for character manually and now it seems to work. Before I copied it from a PDF, maybe that was the mistake?

pdf could be encoded in whataver-ways =)

Yes, but I thought if I copy it into my Code App it automatically turns to the right encoding :zipper_mouth_face:

I’ve used the follow snippet in the past and it’s been working well for me, but with email, it also always highly depends on the email client used and there are hundred of clients…

Example code as used in combination with the Uniform plugin:

    'to' => iconv("UTF-8", "ISO-8859-1", $form->data('email')),
    'from' => '',
    'fromName' => iconv("UTF-8", "ISO-8859-1", 'Newsletter Bestätigung'),
    'replyTo' => '',
    'replyToName' => iconv("UTF-8", "ISO-8859-1", 'Newsletter Bestätigung'),
    'subject' => iconv("UTF-8", "ISO-8859-1", 'Bestätigung Ihres Newsletters'),
    'snippet' => 'emails/confirmed',