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

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.