mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-28 22:53:54 +03:00
Merge branch 'develop' into develop
This commit is contained in:
commit
980282a06f
2 changed files with 10 additions and 1 deletions
|
@ -160,7 +160,7 @@ func composeIssueMessage(issue *Issue, doer *User, tplName base.TplName, tos []s
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(3, "HTMLString (%s): %v", tplName, err)
|
log.Error(3, "HTMLString (%s): %v", tplName, err)
|
||||||
}
|
}
|
||||||
msg := mailer.NewMessageFrom(tos, fmt.Sprintf(`"%s" <%s>`, doer.DisplayName(), setting.MailService.User), subject, content)
|
msg := mailer.NewMessageFrom(tos, fmt.Sprintf(`"%s" <%s>`, doer.DisplayName(), setting.MailService.FromEmail), subject, content)
|
||||||
msg.Info = fmt.Sprintf("Subject: %s, %s", subject, info)
|
msg.Info = fmt.Sprintf("Subject: %s, %s", subject, info)
|
||||||
return msg
|
return msg
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ package setting
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/mail"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
@ -714,6 +715,7 @@ type Mailer struct {
|
||||||
Name string
|
Name string
|
||||||
Host string
|
Host string
|
||||||
From string
|
From string
|
||||||
|
FromEmail string
|
||||||
User, Passwd string
|
User, Passwd string
|
||||||
DisableHelo bool
|
DisableHelo bool
|
||||||
HeloHostname string
|
HeloHostname string
|
||||||
|
@ -749,6 +751,13 @@ func newMailService() {
|
||||||
EnableHTMLAlternative: sec.Key("ENABLE_HTML_ALTERNATIVE").MustBool(),
|
EnableHTMLAlternative: sec.Key("ENABLE_HTML_ALTERNATIVE").MustBool(),
|
||||||
}
|
}
|
||||||
MailService.From = sec.Key("FROM").MustString(MailService.User)
|
MailService.From = sec.Key("FROM").MustString(MailService.User)
|
||||||
|
|
||||||
|
parsed, err := mail.ParseAddress(MailService.From)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(4, "Invalid mailer.FROM (%s): %v", MailService.From, err)
|
||||||
|
}
|
||||||
|
MailService.FromEmail = parsed.Address
|
||||||
|
|
||||||
log.Info("Mail Service Enabled")
|
log.Info("Mail Service Enabled")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue