Feat: option for using SSL connection in mail queue

This commit is contained in:
HFO4
2020-05-11 09:29:19 +08:00
parent 58856612e2
commit 1172765c58
5 changed files with 19 additions and 11 deletions

View File

@@ -22,7 +22,7 @@ type SMTPConfig struct {
Port int // 服务器端口
User string // 用户名
Password string // 密码
Encryption string // 是否启用加密
Encryption bool // 是否启用加密
Keepalive int // SMTP 连接保留时长
}
@@ -77,6 +77,11 @@ func (client *SMTP) Init() {
d.Timeout = time.Duration(client.Config.Keepalive+5) * time.Second
client.chOpen = true
// 是否启用 SSL
if client.Config.Encryption {
d.SSL = true
}
var s mail.SendCloser
var err error
open := false