mirror of
https://github.com/go-gitea/gitea
synced 2025-12-07 05:18:29 +00:00
Use Golang net/smtp instead of gomail's smtp to send email (#36055)
Replace #36032 Fix #36030 This PR use `net/smtp` instead of gomail's smtp. Now github.com/wneessen/go-mail will be used only for generating email message body. --------- Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
@@ -33,7 +33,13 @@ func (s *SendmailSender) Send(from string, to []string, msg io.WriterTo) error {
|
||||
|
||||
args := []string{"-f", envelopeFrom, "-i"}
|
||||
args = append(args, setting.MailService.SendmailArgs...)
|
||||
args = append(args, to...)
|
||||
for _, recipient := range to {
|
||||
smtpTo, err := sanitizeEmailAddress(recipient)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid recipient address %q: %w", recipient, err)
|
||||
}
|
||||
args = append(args, smtpTo)
|
||||
}
|
||||
log.Trace("Sending with: %s %v", setting.MailService.SendmailPath, args)
|
||||
|
||||
desc := fmt.Sprintf("SendMail: %s %v", setting.MailService.SendmailPath, args)
|
||||
|
||||
Reference in New Issue
Block a user