mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-29 12:30:11 +00:00
Compare commits
No commits in common. "3d0f75626462844b920e4ff95b95a9891a7ac88f" and "4924700c52c95db15e7c9f130eca3449a8f3c7c2" have entirely different histories.
3d0f756264
...
4924700c52
@ -76,7 +76,6 @@ func (app *appContext) loadConfig() error {
|
|||||||
|
|
||||||
app.MustSetValue("smtp", "hello_hostname", "localhost")
|
app.MustSetValue("smtp", "hello_hostname", "localhost")
|
||||||
app.MustSetValue("smtp", "cert_validation", "true")
|
app.MustSetValue("smtp", "cert_validation", "true")
|
||||||
app.MustSetValue("smtp", "auth_type", "4")
|
|
||||||
|
|
||||||
sc := app.config.Section("discord").Key("start_command").MustString("start")
|
sc := app.config.Section("discord").Key("start_command").MustString("start")
|
||||||
app.config.Section("discord").Key("start_command").SetValue(strings.TrimPrefix(strings.TrimPrefix(sc, "/"), "!"))
|
app.config.Section("discord").Key("start_command").SetValue(strings.TrimPrefix(strings.TrimPrefix(sc, "/"), "!"))
|
||||||
|
@ -918,22 +918,6 @@
|
|||||||
"type": "bool",
|
"type": "bool",
|
||||||
"value": true,
|
"value": true,
|
||||||
"description": "Warning, disabling this makes you much more vulnerable to man-in-the-middle attacks"
|
"description": "Warning, disabling this makes you much more vulnerable to man-in-the-middle attacks"
|
||||||
},
|
|
||||||
"auth_type": {
|
|
||||||
"name": "Authentication type",
|
|
||||||
"required": false,
|
|
||||||
"requires_restart": false,
|
|
||||||
"advanced": false,
|
|
||||||
"type": "select",
|
|
||||||
"options": [
|
|
||||||
["0", "Plain"],
|
|
||||||
["1", "Login"],
|
|
||||||
["2", "CRAM-MD5"],
|
|
||||||
["3", "None"],
|
|
||||||
["4", "Auto"]
|
|
||||||
],
|
|
||||||
"value": 4,
|
|
||||||
"description": "SMTP authentication method"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
7
email.go
7
email.go
@ -92,8 +92,7 @@ func NewEmailer(app *appContext) *Emailer {
|
|||||||
if app.proxyEnabled {
|
if app.proxyEnabled {
|
||||||
proxyConf = &app.proxyConfig
|
proxyConf = &app.proxyConfig
|
||||||
}
|
}
|
||||||
authType := sMail.AuthType(app.config.Section("smtp").Key("auth_type").MustInt(4))
|
err := emailer.NewSMTP(app.config.Section("smtp").Key("server").String(), app.config.Section("smtp").Key("port").MustInt(465), username, password, sslTLS, app.config.Section("smtp").Key("ssl_cert").MustString(""), app.config.Section("smtp").Key("hello_hostname").String(), app.config.Section("smtp").Key("cert_validation").MustBool(true), proxyConf)
|
||||||
err := emailer.NewSMTP(app.config.Section("smtp").Key("server").String(), app.config.Section("smtp").Key("port").MustInt(465), username, password, sslTLS, app.config.Section("smtp").Key("ssl_cert").MustString(""), app.config.Section("smtp").Key("hello_hostname").String(), app.config.Section("smtp").Key("cert_validation").MustBool(true), authType, proxyConf)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.err.Printf("Error while initiating SMTP mailer: %v", err)
|
app.err.Printf("Error while initiating SMTP mailer: %v", err)
|
||||||
}
|
}
|
||||||
@ -119,7 +118,7 @@ type SMTP struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSMTP returns an SMTP emailClient.
|
// NewSMTP returns an SMTP emailClient.
|
||||||
func (emailer *Emailer) NewSMTP(server string, port int, username, password string, sslTLS bool, certPath string, helloHostname string, validateCertificate bool, authType sMail.AuthType, proxy *easyproxy.ProxyConfig) (err error) {
|
func (emailer *Emailer) NewSMTP(server string, port int, username, password string, sslTLS bool, certPath string, helloHostname string, validateCertificate bool, proxy *easyproxy.ProxyConfig) (err error) {
|
||||||
sender := &SMTP{}
|
sender := &SMTP{}
|
||||||
sender.Client = sMail.NewSMTPClient()
|
sender.Client = sMail.NewSMTPClient()
|
||||||
if sslTLS {
|
if sslTLS {
|
||||||
@ -128,7 +127,7 @@ func (emailer *Emailer) NewSMTP(server string, port int, username, password stri
|
|||||||
sender.Client.Encryption = sMail.EncryptionSTARTTLS
|
sender.Client.Encryption = sMail.EncryptionSTARTTLS
|
||||||
}
|
}
|
||||||
if username != "" || password != "" {
|
if username != "" || password != "" {
|
||||||
sender.Client.Authentication = authType
|
sender.Client.Authentication = sMail.AuthLogin
|
||||||
sender.Client.Username = username
|
sender.Client.Username = username
|
||||||
sender.Client.Password = password
|
sender.Client.Password = password
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user