|
|
@ -10,6 +10,7 @@ import ( |
|
|
|
"net" |
|
|
|
"net" |
|
|
|
"net/mail" |
|
|
|
"net/mail" |
|
|
|
"net/smtp" |
|
|
|
"net/smtp" |
|
|
|
|
|
|
|
"os" |
|
|
|
"strings" |
|
|
|
"strings" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/gogits/gogs/modules/log" |
|
|
|
"github.com/gogits/gogs/modules/log" |
|
|
@ -95,6 +96,15 @@ func sendMail(settings *setting.Mailer, recipients []string, msgContent []byte) |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hostname, err := os.Hostname() |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
return err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if err = client.Hello(hostname); err != nil { |
|
|
|
|
|
|
|
return err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// If not using SMTPS, alway use STARTTLS if available
|
|
|
|
// If not using SMTPS, alway use STARTTLS if available
|
|
|
|
hasStartTLS, _ := client.Extension("STARTTLS") |
|
|
|
hasStartTLS, _ := client.Extension("STARTTLS") |
|
|
|
if !isSecureConn && hasStartTLS { |
|
|
|
if !isSecureConn && hasStartTLS { |
|
|
|