mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-15 02:45:22 +00:00
parent
16d7596635
commit
32999e2511
|
@ -179,6 +179,15 @@ func newMailService() {
|
||||||
|
|
||||||
// we want to warn if users use SMTP on a non-local IP;
|
// we want to warn if users use SMTP on a non-local IP;
|
||||||
// we might as well take the opportunity to check that it has an IP at all
|
// we might as well take the opportunity to check that it has an IP at all
|
||||||
|
// This check is not needed for sendmail
|
||||||
|
switch MailService.Protocol {
|
||||||
|
case "sendmail":
|
||||||
|
var err error
|
||||||
|
MailService.SendmailArgs, err = shellquote.Split(sec.Key("SENDMAIL_ARGS").String())
|
||||||
|
if err != nil {
|
||||||
|
log.Error("Failed to parse Sendmail args: '%s' with error %v", sec.Key("SENDMAIL_ARGS").String(), err)
|
||||||
|
}
|
||||||
|
case "smtp", "smtps", "smtp+starttls", "smtp+unix":
|
||||||
ips := tryResolveAddr(MailService.SMTPAddr)
|
ips := tryResolveAddr(MailService.SMTPAddr)
|
||||||
if MailService.Protocol == "smtp" {
|
if MailService.Protocol == "smtp" {
|
||||||
for _, ip := range ips {
|
for _, ip := range ips {
|
||||||
|
@ -188,6 +197,8 @@ func newMailService() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case "dummy": // just mention and do nothing
|
||||||
|
}
|
||||||
|
|
||||||
if MailService.From != "" {
|
if MailService.From != "" {
|
||||||
parsed, err := mail.ParseAddress(MailService.From)
|
parsed, err := mail.ParseAddress(MailService.From)
|
||||||
|
@ -215,14 +226,6 @@ func newMailService() {
|
||||||
MailService.EnvelopeFrom = parsed.Address
|
MailService.EnvelopeFrom = parsed.Address
|
||||||
}
|
}
|
||||||
|
|
||||||
if MailService.Protocol == "sendmail" {
|
|
||||||
var err error
|
|
||||||
MailService.SendmailArgs, err = shellquote.Split(sec.Key("SENDMAIL_ARGS").String())
|
|
||||||
if err != nil {
|
|
||||||
log.Error("Failed to parse Sendmail args: %s with error %v", CustomConf, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Info("Mail Service Enabled")
|
log.Info("Mail Service Enabled")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue