Skip to content

Commit c47afdf

Browse files
committed
add config options for HELO
1 parent c76ee1c commit c47afdf

File tree

7 files changed

+61
-47
lines changed

7 files changed

+61
-47
lines changed

.gopmfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ github.com/macaron-contrib/session = commit:31e841d95c
2424
github.com/macaron-contrib/toolbox = commit:acbfe36e16
2525
github.com/mattn/go-sqlite3 = commit:e28cd440fa
2626
github.com/microcosm-cc/bluemonday = commit:fcd0f5074e
27+
github.com/msteinert/pam =
2728
github.com/nfnt/resize = commit:53e9ca890b
2829
github.com/russross/blackfriday = commit:6928e11ecd
2930
github.com/shurcooL/go = commit:bc30a0bd33

conf/app.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ SUBJECT = %(APP_NAME)s
105105
; QQ: smtp.qq.com:25
106106
; 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.
107107
HOST =
108+
; Disable HELO operation when hostname are different.
109+
DISABLE_HELO =
110+
; Custom hostname for HELO operation, default is from system.
111+
HELO_HOSTNAME =
108112
; Do not verify the certificate of the server. Only use this for self-signed certificates
109113
SKIP_VERIFY =
110114
; Use client certificate

gogs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"github.com/gogits/gogs/modules/setting"
1818
)
1919

20-
const APP_VER = "0.6.1.0327 Beta"
20+
const APP_VER = "0.6.1.0703 Beta"
2121

2222
func init() {
2323
runtime.GOMAXPROCS(runtime.NumCPU())

modules/bindata/bindata.go

Lines changed: 39 additions & 39 deletions
Large diffs are not rendered by default.

modules/mailer/mailer.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,18 @@ func sendMail(settings *setting.Mailer, recipients []string, msgContent []byte)
104104
return err
105105
}
106106

107-
hostname, err := os.Hostname()
108-
if err != nil {
109-
return err
110-
}
107+
if !setting.MailService.DisableHelo {
108+
hostname := setting.MailService.HeloHostname
109+
if len(hostname) == 0 {
110+
hostname, err = os.Hostname()
111+
if err != nil {
112+
return err
113+
}
114+
}
111115

112-
if err = client.Hello(hostname); err != nil {
113-
return err
116+
if err = client.Hello(hostname); err != nil {
117+
return err
118+
}
114119
}
115120

116121
// If not using SMTPS, alway use STARTTLS if available

modules/setting/setting.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,8 @@ type Mailer struct {
478478
Host string
479479
From string
480480
User, Passwd string
481+
DisableHelo bool
482+
HeloHostname string
481483
SkipVerify bool
482484
UseCertificate bool
483485
CertFile, KeyFile string
@@ -512,6 +514,8 @@ func newMailService() {
512514
Host: sec.Key("HOST").String(),
513515
User: sec.Key("USER").String(),
514516
Passwd: sec.Key("PASSWD").String(),
517+
DisableHelo: sec.Key("DISABLE_HELO").MustBool(),
518+
HeloHostname: sec.Key("HELO_HOSTNAME").String(),
515519
SkipVerify: sec.Key("SKIP_VERIFY").MustBool(),
516520
UseCertificate: sec.Key("USE_CERTIFICATE").MustBool(),
517521
CertFile: sec.Key("CERT_FILE").String(),

templates/.VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.6.1.0327 Beta
1+
0.6.1.0703 Beta

0 commit comments

Comments
 (0)