From 6ef93951406eaf982c9baa2fe52ff8381411bdf1 Mon Sep 17 00:00:00 2001 From: Gonne Date: Wed, 26 Mar 2025 13:32:51 +0100 Subject: [PATCH] Apply all options to smtp session --- repositories/request.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/repositories/request.go b/repositories/request.go index 0d88dda..011f015 100644 --- a/repositories/request.go +++ b/repositories/request.go @@ -165,12 +165,13 @@ func (r *RequestRepo) sendConfirmationMail(request models.Request) error { message.SetBodyString(mail.TypeTextPlain, messageText.String()) var options []mail.Option + options = append(options, mail.WithPort(r.config.Mailer.SmtpPort)) if r.config.Mailer.SmtpUseAuth { options = append(options, mail.WithSMTPAuth(mail.SMTPAuthPlain)) options = append(options, mail.WithUsername(r.config.Mailer.SmtpIdentity)) options = append(options, mail.WithPassword(r.config.Mailer.SmtpPassword)) } - client, err := mail.NewClient(r.config.Mailer.SmtpHost, mail.WithPort(r.config.Mailer.SmtpPort)) + client, err := mail.NewClient(r.config.Mailer.SmtpHost, options...) if err != nil { log.Println(err.Error()) return err