Apply all options to smtp session
This commit is contained in:
parent
a05407eba0
commit
6ef9395140
1 changed files with 2 additions and 1 deletions
|
@ -165,12 +165,13 @@ func (r *RequestRepo) sendConfirmationMail(request models.Request) error {
|
||||||
message.SetBodyString(mail.TypeTextPlain, messageText.String())
|
message.SetBodyString(mail.TypeTextPlain, messageText.String())
|
||||||
|
|
||||||
var options []mail.Option
|
var options []mail.Option
|
||||||
|
options = append(options, mail.WithPort(r.config.Mailer.SmtpPort))
|
||||||
if r.config.Mailer.SmtpUseAuth {
|
if r.config.Mailer.SmtpUseAuth {
|
||||||
options = append(options, mail.WithSMTPAuth(mail.SMTPAuthPlain))
|
options = append(options, mail.WithSMTPAuth(mail.SMTPAuthPlain))
|
||||||
options = append(options, mail.WithUsername(r.config.Mailer.SmtpIdentity))
|
options = append(options, mail.WithUsername(r.config.Mailer.SmtpIdentity))
|
||||||
options = append(options, mail.WithPassword(r.config.Mailer.SmtpPassword))
|
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 {
|
if err != nil {
|
||||||
log.Println(err.Error())
|
log.Println(err.Error())
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Add table
Reference in a new issue