mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	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:
		@@ -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")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user