Feat: option for using SSL connection in mail queue
This commit is contained in:
parent
58856612e2
commit
1172765c58
5 changed files with 19 additions and 11 deletions
2
assets
2
assets
|
@ -1 +1 @@
|
||||||
Subproject commit 538bd95a7ba1712bf8b079375d1aa419d803273a
|
Subproject commit 0e8e26e4dee4100dcff1089f83fc34fe165de65a
|
|
@ -90,6 +90,7 @@ func addDefaultSettings() {
|
||||||
{Name: "replyTo", Value: `abslant@126.com`, Type: "mail"},
|
{Name: "replyTo", Value: `abslant@126.com`, Type: "mail"},
|
||||||
{Name: "smtpUser", Value: `no-reply@acg.blue`, Type: "mail"},
|
{Name: "smtpUser", Value: `no-reply@acg.blue`, Type: "mail"},
|
||||||
{Name: "smtpPass", Value: ``, Type: "mail"},
|
{Name: "smtpPass", Value: ``, Type: "mail"},
|
||||||
|
{Name: "smtpEncryption", Value: `0`, Type: "mail"},
|
||||||
{Name: "maxEditSize", Value: `4194304`, Type: "file_edit"},
|
{Name: "maxEditSize", Value: `4194304`, Type: "file_edit"},
|
||||||
{Name: "archive_timeout", Value: `60`, Type: "timeout"},
|
{Name: "archive_timeout", Value: `60`, Type: "timeout"},
|
||||||
{Name: "download_timeout", Value: `60`, Type: "timeout"},
|
{Name: "download_timeout", Value: `60`, Type: "timeout"},
|
||||||
|
|
|
@ -4,7 +4,7 @@ package conf
|
||||||
var BackendVersion = "3.0.0-beta1"
|
var BackendVersion = "3.0.0-beta1"
|
||||||
|
|
||||||
// RequiredDBVersion 与当前版本匹配的数据库版本
|
// RequiredDBVersion 与当前版本匹配的数据库版本
|
||||||
var RequiredDBVersion = "3.0.0"
|
var RequiredDBVersion = "3.0.0-33-g5885661"
|
||||||
|
|
||||||
// RequiredStaticVersion 与当前版本匹配的静态资源版本
|
// RequiredStaticVersion 与当前版本匹配的静态资源版本
|
||||||
var RequiredStaticVersion = "3.0.0"
|
var RequiredStaticVersion = "3.0.0"
|
||||||
|
|
|
@ -30,6 +30,7 @@ func Init() {
|
||||||
"replyTo",
|
"replyTo",
|
||||||
"smtpUser",
|
"smtpUser",
|
||||||
"smtpPass",
|
"smtpPass",
|
||||||
|
"smtpEncryption",
|
||||||
)
|
)
|
||||||
port := model.GetIntSetting("smtpPort", 25)
|
port := model.GetIntSetting("smtpPort", 25)
|
||||||
keepAlive := model.GetIntSetting("mail_keepalive", 30)
|
keepAlive := model.GetIntSetting("mail_keepalive", 30)
|
||||||
|
@ -43,6 +44,7 @@ func Init() {
|
||||||
User: options["smtpUser"],
|
User: options["smtpUser"],
|
||||||
Password: options["smtpPass"],
|
Password: options["smtpPass"],
|
||||||
Keepalive: keepAlive,
|
Keepalive: keepAlive,
|
||||||
|
Encryption: model.IsTrueVal(options["smtpEncryption"]),
|
||||||
})
|
})
|
||||||
|
|
||||||
Client = client
|
Client = client
|
||||||
|
|
|
@ -22,7 +22,7 @@ type SMTPConfig struct {
|
||||||
Port int // 服务器端口
|
Port int // 服务器端口
|
||||||
User string // 用户名
|
User string // 用户名
|
||||||
Password string // 密码
|
Password string // 密码
|
||||||
Encryption string // 是否启用加密
|
Encryption bool // 是否启用加密
|
||||||
Keepalive int // SMTP 连接保留时长
|
Keepalive int // SMTP 连接保留时长
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,6 +77,11 @@ func (client *SMTP) Init() {
|
||||||
d.Timeout = time.Duration(client.Config.Keepalive+5) * time.Second
|
d.Timeout = time.Duration(client.Config.Keepalive+5) * time.Second
|
||||||
client.chOpen = true
|
client.chOpen = true
|
||||||
|
|
||||||
|
// 是否启用 SSL
|
||||||
|
if client.Config.Encryption {
|
||||||
|
d.SSL = true
|
||||||
|
}
|
||||||
|
|
||||||
var s mail.SendCloser
|
var s mail.SendCloser
|
||||||
var err error
|
var err error
|
||||||
open := false
|
open := false
|
||||||
|
|
Loading…
Add table
Reference in a new issue