add config options for HELO

This commit is contained in:
Unknwon 2015-07-03 14:08:18 +08:00
parent c76ee1cf83
commit c47afdff58
7 changed files with 61 additions and 47 deletions

@ -24,6 +24,7 @@ github.com/macaron-contrib/session = commit:31e841d95c
github.com/macaron-contrib/toolbox = commit:acbfe36e16
github.com/mattn/go-sqlite3 = commit:e28cd440fa
github.com/microcosm-cc/bluemonday = commit:fcd0f5074e
github.com/msteinert/pam =
github.com/nfnt/resize = commit:53e9ca890b
github.com/russross/blackfriday = commit:6928e11ecd
github.com/shurcooL/go = commit:bc30a0bd33

@ -105,6 +105,10 @@ SUBJECT = %(APP_NAME)s
; QQ: smtp.qq.com:25
; Note, if the port ends with "465", SMTPS will be used. Using STARTTLS on port 587 is recommended per RFC 6409. If the server supports STARTTLS it will always be used.
HOST =
; Disable HELO operation when hostname are different.
DISABLE_HELO =
; Custom hostname for HELO operation, default is from system.
HELO_HOSTNAME =
; Do not verify the certificate of the server. Only use this for self-signed certificates
SKIP_VERIFY =
; Use client certificate

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)
const APP_VER = "0.6.1.0327 Beta"
const APP_VER = "0.6.1.0703 Beta"
func init() {
runtime.GOMAXPROCS(runtime.NumCPU())

File diff suppressed because one or more lines are too long

@ -104,13 +104,18 @@ func sendMail(settings *setting.Mailer, recipients []string, msgContent []byte)
return err
}
hostname, err := os.Hostname()
if err != nil {
return err
}
if !setting.MailService.DisableHelo {
hostname := setting.MailService.HeloHostname
if len(hostname) == 0 {
hostname, err = os.Hostname()
if err != nil {
return err
}
}
if err = client.Hello(hostname); err != nil {
return err
if err = client.Hello(hostname); err != nil {
return err
}
}
// If not using SMTPS, alway use STARTTLS if available

@ -478,6 +478,8 @@ type Mailer struct {
Host string
From string
User, Passwd string
DisableHelo bool
HeloHostname string
SkipVerify bool
UseCertificate bool
CertFile, KeyFile string
@ -512,6 +514,8 @@ func newMailService() {
Host: sec.Key("HOST").String(),
User: sec.Key("USER").String(),
Passwd: sec.Key("PASSWD").String(),
DisableHelo: sec.Key("DISABLE_HELO").MustBool(),
HeloHostname: sec.Key("HELO_HOSTNAME").String(),
SkipVerify: sec.Key("SKIP_VERIFY").MustBool(),
UseCertificate: sec.Key("USE_CERTIFICATE").MustBool(),
CertFile: sec.Key("CERT_FILE").String(),

@ -1 +1 @@
0.6.1.0327 Beta
0.6.1.0703 Beta