How to set encoding in PHP Mailer?

        $mail->Subject = $subject;
        $mail->Body = $message_content;
        $mail->addCustomHeader("Content-type", "text/html; charset=UTF-8");

how to set also for a subject variable?
Example: charset=UTF-8"

Probably

$mail->CharSet = 'UTF-8';

as given in the documentation?

I have tested your line. Thank you for the message!
I have an issue as it is working inside body but Subject is still unknown lettter ščćžđ.

Can be improved SUBJECT value like:

<?php
$mail->Subject = mb_convert_encoding($subject, "UTF-8", "auto");
?>

It seems it is divided encoding inside protocol for SMTP for a subject, header, body…

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.