Saad Bahir
04/28/2025, 10:32 AMSaad Bahir
04/28/2025, 10:33 AMfunc (s *SMTP) SendEmail(to, subject, body string) error {
msgString := "From: " + s.From + "\r\n" +
"To: " + to + "\r\n" +
"Subject: " + subject + "\r\n" +
"MIME-Version: 1.0\r\n" +
"Content-Type: text/html; charset=UTF-8\r\n" +
"\r\n" +
body
msg := []byte(msgString)
addr := s.Host + ":" + s.Port
if s.Password == "" || s.Username == "" {
return smtp.SendMail(addr, nil, s.From, strings.Split(to, ","), msg)
} else {
auth := smtp.PlainAuth("", s.Username, s.Password, s.Host)
return smtp.SendMail(addr, auth, s.From, strings.Split(to, ","), msg)
}
It seems that it's never executed
or maybe the plainAuth
fails silently?Nagesh Bansal
04/28/2025, 11:07 AMSaad Bahir
04/28/2025, 11:22 AMfailed to send email
Saad Bahir
04/28/2025, 11:22 AM"error":"dial tcp :0: connect: connection refused","stacktrace":"<http://github.com/SigNoz/signoz/pkg/query-service/auth.inviteEmail|github.com/SigNoz/signoz/pkg/query-service/auth.inviteEmail>
Nagesh Bansal
04/28/2025, 11:27 AMSaad Bahir
04/28/2025, 11:29 AMNagesh Bansal
04/28/2025, 11:30 AMSaad Bahir
04/28/2025, 11:31 AMNagesh Bansal
04/28/2025, 11:41 AMSaad Bahir
04/28/2025, 11:42 AMsmtpVars
in the helm charts which automatically generates the SMTP env variables
Here is the Statefulset definition for signozSaad Bahir
04/28/2025, 11:42 AMSaad Bahir
04/28/2025, 11:51 AM465
(TLS/SSL) to 587
(STARTTLS) and now I am getting
{"level":"error","timestamp":"2025-04-28T11:50:25.447Z","caller":"auth/auth.go:255","msg":"failed to send email","error":"501 Error: Bad sender address syntax","stacktrace":"<http://github.com/SigNoz/signoz/pkg/query-service/auth.inviteEmail|github.com/SigNoz/signoz/pkg/query-service/auth.inviteEmail>\n\t/home/runner/work/signoz/signoz/pkg/query-service/auth/auth.go:255\ngithub.com/SigNoz/signoz/pkg/query-service/auth.Invite\n\t/home/runner/work/signoz/signoz/pkg/query-service/auth/auth.go:115\ngithub.com/SigNoz/signoz/pkg/query-service/app.(*APIHandler).
Saad Bahir
04/28/2025, 11:55 AM587
it seems that the smtp Go package doesn't support TLS
PS: the error Bad sender address syntax
is because it seems that it doesnt support the FROM
format of name <email>
but just email
Nagesh Bansal
04/28/2025, 11:56 AMSaad Bahir
04/28/2025, 12:05 PMSaad Bahir
04/28/2025, 12:05 PM465
as a portNagesh Bansal
04/28/2025, 12:06 PM