From 36f3860c4c3df9c5eff3a26295585b92b8ca07c7 Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Wed, 10 Nov 2021 20:12:31 +0000 Subject: [PATCH] SMTP: Always use plaintext as main body Adding the HTML as the alternative body caused the plaintext email to always appear. Should fix #164. --- email.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/email.go b/email.go index b5c5563d..dd940296 100644 --- a/email.go +++ b/email.go @@ -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