Email Notifications - broken email content encoding and empty 'Sender' field

On Team Notifications we receive malformed text which looks good in he browser (UTF8 encoding) - Is there any way to set email encoding? Maybe HTML formatter breaks something?

received: “juĹĽ i w piÄ…tek siÄ™” instead “już i piątek się”.

Also the SMTP field sender is empty. I have configured:

mattermost[‘email_feedback_email’] = email@domain
mattermost[‘email_send_email_notifications’] = true
mattermost[‘email_feedback_name’] = "my text"
mattermost[‘email_smtp_server’] = myserver
mattermost[‘email_smtp_port’] = 25

This is new, as we started using this today.
Thanks :smile:

We are using: gitlab-ce-8.1.0-ce.1.el7.x86_64

1 Like

hi @kmazurek,

There isn’t a setting to change the email encoding, can you let us know what email client you’re using?

If there’s a bug rendering characters in non-English languages we should fix it,

We live in corporate environment, so we user IBM (Lotus) Notes as email client software, which is not very ergonomic in use, but reliable. I don’t manage mailing systems, just gitlab products for deparment.

I managet to hijack the email on molal MTA:

From MAILER-DAEMON  Thu Oct 29 11:36:02 2015
Return-Path: <>
Delivered-To: root@localhost.localdomain
Received: from localhost (localhost [])
    by localhost.localdomain (Postfix) with ESMTP id 09FB680725D7
    for <>; Thu, 29 Oct 2015 11:36:01 +0100 (CET)
Subject: [GitLab Mattermost] Project Team Notifications for Oct 29, 2015
MIME-version: 1.0
Content-Type: text/html
Date: Thu, 29 Oct 2015 11:36:01 +0100
From: <>
To: <>
Message-Id: <20151029103602.09FB680725D7@localhost.localdomain>

<p>CHANNEL: piotr<br>krzysztof- 10:36 GMT, Oct 29<br><pre style="text-align:left;font-family: 'Lato', sans-serif; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">[4] test mattermost ążćńźłóęśń ĄŻŹĆŃŁÓŚĘ [2] test mattermost ążćńźłóęśń ĄŻŹĆŃŁÓŚĘ</pre></p>

  1. So in terminal or notepad++ I can see polish native characters (as intended in UTF8). As I suspected there is no encoding in mail headers.
  2. The “From:” fiels is empty


Just checked the github repository and the issue should be fixed in commit 830c6b3f:

commit 830c6b3f1ebdfc38ca8ee0e6c672301fbe884e21
Author: Melvi Ts
Date: Thu Oct 15 21:17:52 2015 +0800

Fix email encoding issue

So we just need a new release (+gitlab release).

@kmazurek do you run standalone instance of mattermost and are you able to test the fix?

$ git diff 830c6b3f~..830c6b3f
diff --git a/utils/mail.go b/utils/mail.go
index c91c15a..07a79ee 100644
--- a/utils/mail.go
+++ b/utils/mail.go
@@ -6,15 +6,22 @@ package utils
 import (
        l4g ""
+       "encoding/base64"
-       "html"
+func encodeRFC2047Word(s string) string {
+       // TODO: use `mime.BEncoding.Encode` instead when `go` >= 1.5
+       // return mime.BEncoding.Encode("utf-8", s)
+       dst := base64.StdEncoding.EncodeToString([]byte(s))
+       return "=?utf-8?b?" + dst + "?="
 func connectToSMTPServer(config *model.Config) (net.Conn, *model.AppError) {
        var conn net.Conn
        var err error
@@ -102,9 +109,10 @@ func SendMailUsingConfig(to, subject, body string, config *model.Config) *model.
        headers := make(map[string]string)
        headers["From"] = fromMail.String()
        headers["To"] = toMail.String()
-       headers["Subject"] = html.UnescapeString(subject)
+       headers["Subject"] = encodeRFC2047Word(subject)
        headers["MIME-version"] = "1.0"
-       headers["Content-Type"] = "text/html"
+       headers["Content-Type"] = "text/html; charset=\"utf-8\""
+       headers["Content-Transfer-Encoding"] = "8bit"
        headers["Date"] = time.Now().Format(time.RFC1123Z)
        message := ""
1 Like

Unfortunately we use gitlab-ce-8.1.0 bundle with mattermost. So I have to wait for another gitlab-ce release.

Updated to gitlab-ce-8.1.2-ce.0.el7.x86_64 - sender address present, unfortunately Content-type: text/html is without encoding.

gitlab-ce-8.1.3-ce.0.el7.x86_64 - Content-type: text/html, message in html is still without encoding (utf-8).