Skip to content

Commit

Permalink
feat: make the email client explicity set the format to be HTML (supa…
Browse files Browse the repository at this point in the history
…base#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.
  • Loading branch information
mansueli authored and LashaJini committed Nov 13, 2024
1 parent 6923d3a commit 6afb7f1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/mailer/mailer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6afb7f1

Please sign in to comment.