diff --git a/sender/sender.go b/sender/sender.go index dfb1ae7e957595cee1cfd0ae49f220d378035b80..2b64bb1acb5ed189ff83c78ef8c6635baa8e5db3 100644 --- a/sender/sender.go +++ b/sender/sender.go @@ -23,10 +23,12 @@ func SendEmail(cfg *config.Config, to []string, subject, body string) error { } auth := smtp.PlainAuth("", cfg.Email, cfg.Password, smtpHost) - msg := []byte("To: " + to[0] + "\r\n" + - "Subject: " + subject + "\r\n" + - "\r\n" + - body) + msg := fmt.Sprintf("From: %s <%s>\r\n", "Some Name", cfg.Email) + + fmt.Sprintf("To: %s\r\n", to[0]) + + fmt.Sprintf("Subject: %s\r\n", subject) + + "\r\n" + // An empty line is required between headers and the body. + body + addr := smtpHost + ":" + smtpPort - return smtp.SendMail(addr, auth, cfg.Email, to, msg) + return smtp.SendMail(addr, auth, cfg.Email, to, []byte(msg)) } \ No newline at end of file