From 2e08c0e4d08fee07bc09374cec2f2f6849d91bd0 Mon Sep 17 00:00:00 2001 From: drew Date: Mon, 28 Jul 2025 11:30:58 +0400 Subject: [PATCH] fix: wrong email msg style --- sender/sender.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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