We're Hiring!

Mattermost, Inc.

Am I doing something wrong? -- SMTP Server emails don't send with body text

Summary

When a user triggers an email confirmation email, or a password reset, or any email is sent at all from the mattermost instance, instead of sending the body of the email, it sends the subject line, and that is it.

Steps to reproduce

I am using the latest version of mattermost and elastic email SMTP server.
The SMTP server is set up with port 2525 as indicated by elastic email setup instructions.
The email templates in the templates folder of the mattermost instance I am running have the correct owner and group permissions. There are no errors with my API, webhooks, or websockets.

Expected behavior

I was expecting the emails to send entirely, with the body, instead of simply just the subject line and no other content.

Observed behavior

There is only the header and no body content, other than the unsubscribe button for elastic email, which is configured through their portal and has nothing to do with mattermost.


Also, just a note, I am the founder and leader of team hydra hacking, we are a ethical cybersecurity community, we don’t do anything illegal, we actually are focused on helping others, teaching others, and showing prevention methods to others. Please don’t be concerned that you are helping “the bad guys” as we are sometimes mistaken for.

I appreciate any assistance or suggestions that can be given, this one is beyond my skill set! :slight_smile:

@XxLilBoPeepsxX, can you “Show Original” from within Gmail, and share the text there (privately, if need be).

@jesse Yes, give me just one minute

Here’s the raw email, the only thing I changed is the removal of the delivered-to email.
I appreciate the support!

Delivered-To: [My email, redacted]
Received: by 2002:a05:6a10:5cf:0:0:0:0 with SMTP id p15csp3582148pxt;
        Mon, 21 Sep 2020 10:42:51 -0700 (PDT)
X-Google-Smtp-Source: ABdhPJwJDGyju9Zp3xT6mmTEVxI1lYeyPQeArnbj2oDouFcmTng8/SShnz8xohn12alk7RQ2YbRl
X-Received: by 2002:a1c:4e16:: with SMTP id g22mr443838wmh.99.1600710171768;
        Mon, 21 Sep 2020 10:42:51 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1600710171; cv=none;
        d=google.com; s=arc-20160816;
        b=wXI8eqhVH7BzZeQMadOwKN8O35RwQE3nHCpIJYUwQ79lXhB1PhbyGssMTpUFOmbI40
         8eAkXNjqCzsVtvO3YaQi1gaJ2g/bl7QsH/aDzLmr79LxPxTTCWy3asK5cXUsftGURfcL
         P/zfRRRfbpyF9OQAEZNhmPpNysw5Wor4PsYeqL5lwLU99uFeoC5VZ/kuhJRvY6OWTRNF
         JpcM3uuJUZt1n6T1S3wgcwxFnsFfefKr8nZvzNs0mZyZsP10NkS/qmrjK1iEdQkJup+6
         ewRUdWG3ZG0dzYnWpXVNx3K1aNB3wvGegwAroFWhvYeYcUJuETMZPZ5SUtoCGSWl0ZMJ
         zgIQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-transfer-encoding:mime-version:auto-submitted:precedence
         :list-unsubscribe:to:sender:reply-to:message-id:subject:date:from
         :dkim-signature:dkim-signature;
        bh=fv1wFTY1JcmvubgRDjhhTcu+e1DoUXz3tPb84+VsM2A=;
        b=K1LxyFvToTLVGNFRJE1dtrrK06ZuTa6iSxn9/uqCnqihNZB66l9J5I7lfYHsnDPcBX
         KUMqawZqrgQdLGwDSguhsVnsX4yoGiIyVsZ1FRwYg8HqTauE/t5spQEqQqgj9dI6CczX
         wBGFfQi5u3zrgq5cYJP35+C8757+xjzZR5mkEoBwEvGcBJ4Cxp6puWUl3WkuwKjknRKT
         4Y3W+RiKjs3KyDxsYDUIXykqWUy2x7Vs4ftxOYDyagtAO2GPK+QkUuKal8eYRd6AtJ04
         stI+PMyn+EkePVyOMDPB3FrfBskRwdp3VZDLJhwdpVZBK7Yn3JbJykaYvQZSBAEp7nBw
         iifA==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@teamhydrahacking.com header.s=api header.b=JzBS9TuY;
       dkim=pass header.i=@elasticemail.com header.s=api header.b="QPjX/kYo";
       spf=pass (google.com: domain of comms=teamhydrahacking.com@bounces.teamhydrahacking.com designates 104.243.65.87 as permitted sender) smtp.mailfrom="comms=teamhydrahacking.com@bounces.teamhydrahacking.com";
       dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=teamhydrahacking.com
Return-Path: <comms=teamhydrahacking.com@bounces.teamhydrahacking.com>
Received: from na87.mxout.mta4.net (na87.mxout.mta4.net. [104.243.65.87])
        by mx.google.com with ESMTPS id b130si221108wme.160.2020.09.21.10.42.51
        for <andrew.henke@toledotechnologyacademy.org>
        (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
        Mon, 21 Sep 2020 10:42:51 -0700 (PDT)
Received-SPF: pass (google.com: domain of comms=teamhydrahacking.com@bounces.teamhydrahacking.com designates 104.243.65.87 as permitted sender) client-ip=104.243.65.87;
Authentication-Results: mx.google.com;
       dkim=pass header.i=@teamhydrahacking.com header.s=api header.b=JzBS9TuY;
       dkim=pass header.i=@elasticemail.com header.s=api header.b="QPjX/kYo";
       spf=pass (google.com: domain of comms=teamhydrahacking.com@bounces.teamhydrahacking.com designates 104.243.65.87 as permitted sender) smtp.mailfrom="comms=teamhydrahacking.com@bounces.teamhydrahacking.com";
       dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=teamhydrahacking.com
DKIM-Signature: v=1; a=rsa-sha256; d=teamhydrahacking.com; s=api; c=relaxed/simple; t=1600710169; h=from:date:subject:reply-to:to:list-unsubscribe:mime-version; bh=fv1wFTY1JcmvubgRDjhhTcu+e1DoUXz3tPb84+VsM2A=; b=JzBS9TuYddrwz8w7KrH08EDoTMuplc6o2Iwq8ch9tYNOfU5zYw+hxuCIs+JUFJcY/Xtt9h16yp5 Il2ateQgaxVjVt4rLkS006w1Sil8iiQ6C9ebalNawDQNvoKQ9u3NQdtbqOXmgAGhZXQIjY6pqR5yW kz+xpAh/b14Ncher9+Q=
DKIM-Signature: v=1; a=rsa-sha256; d=elasticemail.com; s=api; c=relaxed/simple; t=1600710169; h=from:date:subject:reply-to:to:list-unsubscribe; bh=fv1wFTY1JcmvubgRDjhhTcu+e1DoUXz3tPb84+VsM2A=; b=QPjX/kYoSRbetU6yAQOuB3EgqVKMMdAtgPHoTilmwlriUHLmc0eoh4q+XIDX3AuGUcfYXdE0ePj r1djC4F0WYUcAtIxSCJSxMkXP+lN4jNKRevZp9m7J6tMXlWo5YShfv2LlrIGPJJ9PmxM7sYORABs/ ImCooUKObsUXHwQv68g=
From: Team Hydra Hacking Comms <comms@teamhydrahacking.com>
Date: Mon, 21 Sep 2020 17:42:49 +0000
Subject: [Team Hydra Hacking] djsplitdisk invited you to join General Team
Message-Id: <4ubqco1wu7ly.-ELQUccP4OU7TnZtlpZ24g2@YGHP.trk.elasticemail.com>
Reply-To: Team Hydra Hacking Comms <DJSplitDisk@teamhydrahacking.com>
Sender: comms@teamhydrahacking.com
To: andrew.henke@toledotechnologyacademy.org
List-Unsubscribe: <mailto:unsubscribe+-ELQUccP4OU7TnZtlpZ24g2@bounces.elasticemail.net?subject=unsubscribe>, <http://YGHP.trk.elasticemail.com/tracking/unsubscribe?msgid=-ELQUccP4OU7TnZtlpZ24g2&c=1308058474017628735>
X-Msg-EID: -ELQUccP4OU7TnZtlpZ24g2
Precedence: bulk
Auto-Submitted: auto-generated
MIME-Version: 1.0
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable


<html><body><img src=3D"http://YGHP.trk.elasticemail.com/tracking/open?msgi=
d=3D-ELQUccP4OU7TnZtlpZ24g2&c=3D1308058474017628735" style=3D"width:1px;hei=
ght:1px" alt=3D"" /><div style=3D"text-align:center; background-color:#fff;=
padding-top:10px;padding-bottom:10px;font-size:8pt;font-family:sans-serif;"=
><a href=3D"http://YGHP.trk.elasticemail.com/tracking/unsubscribe?d=3DlP3h5=
bVYNythMinFamwtgCht6c05hwKfksesOORNuFTAuEascHHgKDuKiHihpE0BQvzZptvcjgw-n_zC=
O8GGexS50UilZcMSfNxiZeGw_oYomLx1vLLO936IK9vX-h3PJw2" style=3D"text-align:ce=
nter;text-decoration:none;color:#666;">UNSUBSCRIBE</a></div><div style=3D"t=
ext-align:center; padding-top:10px;padding-bottom:48px;font-size:8pt;font-f=
amily:sans-serif;"><a href=3D"http://YGHP.trk.elasticemail.com/tracking/cli=
ck?d=3DykW5Teo3L8BFVyYRE1u1AI0kl5hswDLs1z0TisTaOn5_y2dhxI0c0GapTvHbspIbRqTH=
G90NBRDtT_jdUlj26h89p74VS5fNrM0RXkbLqAsv-V609XYuII1-JZ3NDv2J8nP2ZmxQP1djsoa=
HO0mt2Gat3QeBgzVbScBnJh-8h1dX7rAzKzxVLZqiKHC_NGVFodBCQJDFTGCNDG9sLxVBJIY1" =
style=3D"text-align:center;text-decoration:none;color:#666;"><img style=3D"=
width:140px;" src=3D"https://api.elasticemail.com/userfile/a18de9fc-4724-42=
f2-b203-4992ceddc1de/signature_template.png" alt=3D"" /></a></div></body></=
html>

That’s really odd. Can you try testing with a different email service? I wonder if the injection of the unsubscribe/Send with Elastic Email leads to an edge case where our body is regarded as “invalid” and gets discarded.

1 Like

Hello! Sorry for the delayed response, I have also tried the same setup with SendGrid and Pepipost now, both of which also have the same issue. Is there a plugin or integration to interface with an API sending method instead of sending with straight SMTP, or is there any additional information I can provide to allow you to help with troubleshooting any further?

I have a private GitHub repository containing the entire server’s install, so I can back it up. If you would be able to gain better insight into the issues that might be occurring by viewing the source directly, I would be more then happy to provide access to it! :slight_smile:

What I do find interesting is that the email sent on clicking “test connection” when configuring the SMTP protocol does indeed show up with the “It appears that your Mattermost email is setup correctly” message in the body, but other then that no other emails period have had any body content at all.

I was looking at the logs, and I think I may have just found the issue, I’m just not quite sure how to fix it. This is what the log says: (Note: I redacted my email address)

{"level":"error","ts":1602265087.0879729,"caller":"utils/html.go:115","msg":"Error rendering template","template_name":"invite_body","error":"html/template: \"invite_body\" is undefined"}
{"level":"debug","ts":1602265087.4532378,"caller":"mailservice/mail.go:310","msg":"sending mail","to":"xxxxxx.x.xxxxx@gmail.com","subject":"[Team Hydra Hacking] djsplitdisk invited you to join General Team"}

I have a feeling that this error has been occurring for nearly all of the emails, and I just haven’t seen it until now, honestly. Any suggestions or thoughts on what might be going wrong here?

Hi, @XxLilBoPeepsxX

Circling back on this issue, please check on the Email invitation sent without link with my response to further troubleshoot this? Thanks.

Hi! My apologies for the delay on response, I was doing a kernel update across our servers, including the one hosting our Mattermost instance, and was unable until now to access the templates. Here is the content of the invite_body.html template, as this is one of the one’s specifically referenced. I do have the entire template directory available to view if that would be helpful, and I also have a GitHub repository containing all of the server’s logging backups that I can invite any who would be benefited from having access to the logs to, upon request.

Here is the Invite_body.html code:

action": "Konnte den Webhook nicht abrufen."
  },
  {
    "id": "store.sql_webhooks.get_outgoing.app_error",
    "translation": "Konnte den Webhook nicht abrufen."
  },
  {
    "id": "store.sql_webhooks.get_outgoing_by_channel.app_error",
    "translation": "Konnte die Webhooks nicht abrufen."
  },
  {
    "id": "store.sql_webhooks.get_outgoing_by_team.app_error",
    "translation": "Konnte die Webhooks nicht abrufen."
  },
  {
    "id": "store.sql_webhooks.permanent_delete_incoming_by_channel.app_error",
    "translation": "Konnte den Webhook nicht löschen."
  },
  {
    "id": "store.sql_webhooks.permanent_delete_incoming_by_user.app_error",
    "translation": "Konnte den Webhook nicht löschen."
  },
  {
    "id": "store.sql_webhooks.permanent_delete_outgoing_by_channel.app_error",
    "translation": "Konnte den Webhook nicht löschen."
  },
  {
    "id": "store.sql_webhooks.permanent_delete_outgoing_by_user.app_error",
    "translation": "Konnte den Webhook nicht löschen."
  },
  {
    "id": "store.sql_webhooks.save_incoming.app_error",
    "translation": "Konnte den eingehenden Webhook nicht speichern."
  },
  {
    "id": "store.sql_webhooks.save_incoming.existing.app_error",
    "translation": "Sie können keinen existierenden IncomingWebhook überschreiben"
  },
  {
    "id": "store.sql_webhooks.save_outgoing.app_error",
    "translation": "Konnte den ausgehenden Webhook nicht speichern."
  },
  {
    "id": "store.sql_webhooks.save_outgoing.override.app_error",
    "translation": "Sie können keinen existierenden OutgoingWebhook überschreiben"
  },
  {
    "id": "store.sql_webhooks.update_incoming.app_error",
    "translation": "Konnte den eingehenden Webhook nicht aktualisieren."
  },
  {
    "id": "store.sql_webhooks.update_outgoing.app_error",
    "translation": "Konnte den Webhook nicht aktualisieren."
  },
  {
    "id": "store.update_error",
    "translation": "Aktualisierungsfehler"
  },
  {
    "id": "system.message.name",
    "translation": "System"
  },
  {
    "id": "utils.file.list_directory.local.app_error",
    "translation": "Ein Fehler ist während des Anzeigens des Verzeichnisses vom lokalen Server ist aufgetreten."
  },
  {
    "id": "utils.file.list_directory.s3.app_error",
    "translation": "Ein Fehler ist beim Auflisten des Verzeichnisses von S3 aufgetreten."
  },
  {
    "id": "utils.file.remove_directory.local.app_error",
    "translation": "Ein Fehler ist während des Löschens des Verzeichnisses vom lokalen Server aufgetreten."
  },
  {
    "id": "utils.file.remove_directory.s3.app_error",
    "translation": "Ein Fehler ist beim Entfernen des Verzeichnisses von S3 aufgetreten."
  },
  {
    "id": "utils.file.remove_file.local.app_error",
    "translation": "Ein Fehler ist während des Löschens der Datei vom lokalen Server aufgetreten."
  },
  {
    "id": "utils.file.remove_file.s3.app_error",
    "translation": "Ein Fehler ist beim Entfernen der Datei von S3 aufgetreten."
  },
  {
    "id": "utils.mail.connect_smtp.helo.app_error",
    "translation": "Fehler beim Setzen von HELO"
  },
  {
    "id": "utils.mail.connect_smtp.open.app_error",
    "translation": "Fehler beim Ă–ffnen der Verbindung"
  },
  {
    "id": "utils.mail.connect_smtp.open_tls.app_error",
    "translation": "Fehler beim Ă–ffnen der TLS Verbindung"
  },
  {
    "id": "utils.mail.new_client.auth.app_error",
    "translation": "Fehler beim Authentifizieren am SMTP-Server"
  },
  {
    "id": "utils.mail.sendMail.attachments.write_error",
    "translation": "Fehler beim HinzufĂĽgen des Mailanhanges"
  },
  {
    "id": "utils.mail.send_mail.close.app_error",
    "translation": "Fehler beim SchlieĂźen der Verbindung zum SMTP-Server"
  },
  {
    "id": "utils.mail.send_mail.from_address.app_error",
    "translation": "Fehler beim Setzen von \"Absenderadresse\""
  },
  {
    "id": "utils.mail.send_mail.msg.app_error",
    "translation": "Fehler bei Schreiben der E-Mail"
  },
  {
    "id": "utils.mail.send_mail.msg_data.app_error",
    "translation": "Fehler bei HinzufĂĽgen der E-Mail Daten"
  },
  {
    "id": "utils.mail.send_mail.to_addr

As a side note, I’m not entirely sure why this appears to be in the same language throughout the entire file, especially since the server is running in English only. But I suppose that I may be misunderstanding something.

Not to revive an old thread or anything, but have we made any forward progress on this one? I’ve been trying to figure this one out for nearly two months now, and it’s quite hindering to be completely honest, to not be able to have email integration.