Skip to content

Commit

Permalink
SMTP: Always use plaintext as main body
Browse files Browse the repository at this point in the history
Adding the HTML as the alternative body caused the plaintext email to
always appear. Should fix #164.
  • Loading branch information
hrfee committed Nov 10, 2021
1 parent f78fa28 commit 36f3860
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions email.go
Expand Up @@ -170,11 +170,9 @@ func (sm *SMTP) Send(fromName, fromAddr string, email *Message, address ...strin
e.SetFrom(from)
e.SetSubject(email.Subject)
e.AddTo(address...)
if email.HTML == "" {
e.SetBody(sMail.TextPlain, email.Text)
} else {
e.SetBody(sMail.TextHTML, email.HTML)
e.AddAlternative(sMail.TextPlain, email.Text)
e.SetBody(sMail.TextPlain, email.Text)
if email.HTML != "" {
e.AddAlternative(sMail.TextHTML, email.HTML)
}
err = e.Send(cli)
return err
Expand Down

0 comments on commit 36f3860

Please sign in to comment.