forked from forgejo/forgejo
Rewrite of SendMail function
The SendMail function is rewritten and has the following new functionality: - It is optional to skip verification of keys. The config option SKIP_VERIFY is added - If the port is 465, or ending on 465, the TLS(/SSL) connection is started first.
This commit is contained in:
parent
0a697517ac
commit
87be137b88
3 changed files with 49 additions and 19 deletions
|
@ -437,6 +437,7 @@ type Mailer struct {
|
|||
Host string
|
||||
From string
|
||||
User, Passwd string
|
||||
SkipVerify bool
|
||||
}
|
||||
|
||||
type OauthInfo struct {
|
||||
|
@ -463,10 +464,11 @@ func newMailService() {
|
|||
}
|
||||
|
||||
MailService = &Mailer{
|
||||
Name: Cfg.MustValue("mailer", "NAME", AppName),
|
||||
Host: Cfg.MustValue("mailer", "HOST"),
|
||||
User: Cfg.MustValue("mailer", "USER"),
|
||||
Passwd: Cfg.MustValue("mailer", "PASSWD"),
|
||||
Name: Cfg.MustValue("mailer", "NAME", AppName),
|
||||
Host: Cfg.MustValue("mailer", "HOST"),
|
||||
User: Cfg.MustValue("mailer", "USER"),
|
||||
Passwd: Cfg.MustValue("mailer", "PASSWD"),
|
||||
SkipVerify: Cfg.MustBool("mailer", "SKIP_VERIFY", false),
|
||||
}
|
||||
MailService.From = Cfg.MustValue("mailer", "FROM", MailService.User)
|
||||
log.Info("Mail Service Enabled")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue