Skip to content

Commit

Permalink
feat: make the email client explicity set the format to be HTML (#1149)
Browse files Browse the repository at this point in the history
## 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 Jun 4, 2024
1 parent 5262683 commit 53e223a
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 53e223a

Please sign in to comment.