mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-29 10:57:44 +09:00 
			
		
		
		
	| @@ -178,14 +178,25 @@ 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 | ||||||
| 	ips := tryResolveAddr(MailService.SMTPAddr) | 	// This check is not needed for sendmail | ||||||
| 	if MailService.Protocol == "smtp" { | 	switch MailService.Protocol { | ||||||
| 		for _, ip := range ips { | 	case "sendmail": | ||||||
| 			if !ip.IsLoopback() { | 		var err error | ||||||
| 				log.Warn("connecting over insecure SMTP protocol to non-local address is not recommended") | 		MailService.SendmailArgs, err = shellquote.Split(sec.Key("SENDMAIL_ARGS").String()) | ||||||
| 				break | 		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) | ||||||
|  | 		if MailService.Protocol == "smtp" { | ||||||
|  | 			for _, ip := range ips { | ||||||
|  | 				if !ip.IsLoopback() { | ||||||
|  | 					log.Warn("connecting over insecure SMTP protocol to non-local address is not recommended") | ||||||
|  | 					break | ||||||
|  | 				} | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | 	case "dummy": // just mention and do nothing | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if MailService.From != "" { | 	if MailService.From != "" { | ||||||
| @@ -214,14 +225,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") | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user