Browse Source

add config options for HELO

Unknwon 9 years ago
parent
commit
c47afdff58
7 changed files with 22 additions and 8 deletions
  1. 1 0
      .gopmfile
  2. 4 0
      conf/app.ini
  3. 1 1
      gogs.go
  4. 0 0
      modules/bindata/bindata.go
  5. 11 6
      modules/mailer/mailer.go
  6. 4 0
      modules/setting/setting.go
  7. 1 1
      templates/.VERSION

+ 1 - 0
.gopmfile

@@ -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

+ 4 - 0
conf/app.ini

@@ -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

+ 1 - 1
gogs.go

@@ -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 it is too large
+ 0 - 0
modules/bindata/bindata.go


+ 11 - 6
modules/mailer/mailer.go

@@ -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

+ 4 - 0
modules/setting/setting.go

@@ -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
templates/.VERSION

@@ -1 +1 @@
-0.6.1.0327 Beta
+0.6.1.0703 Beta

Some files were not shown because too many files changed in this diff