Hello Has anyone been able to configure a success...
# support
s
Hello Has anyone been able to configure a successful SMTP connection? 1. I am pretty sure I configured it correctly - I use resend.com as SMTP server 2. The SMTP code within Signoz makes sense and should work but • I don't receive any email and Resend doesn't log any email sent either • I don't see any errors in Signoz logs - all requests have a 200 status code So I am very curious about what could be missing šŸ˜•
this is the code
Copy code
func (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?
n
s
thanks! making progress! now I have an error
Copy code
failed to send email
Copy code
"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>
n
Do you want to send an invite through SMTP?
s
yes exactly !
s
yes that's what i raised above šŸ˜• it doesn't work and there are no error logs
n
Can you share how are you setting up the environment variables? also how are you running signoz?
s
I am using the
smtpVars
in the helm charts which automatically generates the SMTP env variables Here is the Statefulset definition for signoz
I also ssh'ed into the container and made sure that the env variables are defined and have a value I am 100% sure these credentials work because I use it in other instances where it work without problems
I changed the port from
465
(TLS/SSL) to
587
(STARTTLS) and now I am getting
Copy code
{"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).
@Nagesh Bansal that's the trick! just need to change to
587
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
n
Great!!, it's working now?
s
yes! I received the email
Its possible that you have to add in the docs that you don't support
465
as a port
n
okayy, thanks for reporting it. will checkon it. cc: @Vibhu Pandey