HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Encoding used in automatic email messages

When testing how the registration procedure works, I realize that the automatic email sent by the application to members appears fine in the body but messy in the subject.

It must be something with the encoding I suppose.

This is all in Greek language. In the body all look fine, but the subject looks like that:

=?UTF-8?B?W86azr/Ouc69z4zPhM63z4TOsSDOn86jzpTOlV0gU3lzdGVtIM+DzrHPgiA=?= =?UTF-8?B?zq3Pg8+EzrXOuc67zrUgzq3Ovc6xICBtZXNzYWdl?=

Any ideas how to fix this? Maybe the encoding of some files needs to be changed? But which ones?

Or maybe something totally different?


  • galantagalanta New
    edited March 2021

    Well I found the problem, just in case anyone faces the same in the future, which I believe is actually a bug and should be seen as such.

    The email class of vanilla, located at : library/core/class.email.php includes the following code somewhere:

    public function subject($subject) {

        $this->PhpMailer->Subject = mb_encode_mimeheader($subject, $this->PhpMailer->CharSet);

        return $this;


    This means that the subject is encoded before sent to phpmailer for handling the email, which again encodes it, so the subject is encoded twice.

    I believe this should be removed, as phpmailer takes care of the encoding. The other parts of the email aren't sent encoded so they work ok.

    For the quick fix of the issue, one can replace the line inside this function with:

     $this->PhpMailer->Subject = $subject;

    in order not to break other parts that the same class is used

Sign In or Register to comment.