From 6afb7f1e7230658cc6122fd751738804800ff5a9 Mon Sep 17 00:00:00 2001 From: Rodrigo Mansueli Date: Tue, 4 Jun 2024 02:02:54 -0300 Subject: [PATCH] feat: make the email client explicity set the format to be HTML (#1149) ## What kind of change does this PR introduce? This makes the emails to be explicitly set to be HTML formatted instead of plain text which helper older clients that cannot figure this out themselves. ## What is the current behavior? Email messages are sent as plain/text. ## What is the new behavior? Feel free to include screenshots if it includes visual changes. ## Additional context Add any other context or screenshots. --- internal/mailer/mailer.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/mailer/mailer.go b/internal/mailer/mailer.go index 02dc9898b..ff19239d8 100644 --- a/internal/mailer/mailer.go +++ b/internal/mailer/mailer.go @@ -46,8 +46,12 @@ type EmailData struct { func NewMailer(globalConfig *conf.GlobalConfiguration) Mailer { mail := gomail.NewMessage() - // so that messages are not grouped under each other - mail.SetHeader("Message-ID", fmt.Sprintf("<%s@gotrue-mailer>", uuid.Must(uuid.NewV4()).String())) + mail.SetHeaders(map[string][]string{ + // Make the emails explicitly set to be HTML formatted (to cover older email clients) + "Content-Type": {"text/html; charset=utf-8"}, + // so that messages are not grouped under each other + "Message-ID": {fmt.Sprintf("<%s@gotrue-mailer>", uuid.Must(uuid.NewV4()).String())}, + }) from := mail.FormatAddress(globalConfig.SMTP.AdminEmail, globalConfig.SMTP.SenderName) u, _ := url.ParseRequestURI(globalConfig.API.ExternalURL)