forked from TruthHun/BookStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmail.go
More file actions
42 lines (37 loc) · 1.02 KB
/
mail.go
File metadata and controls
42 lines (37 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package conf
import (
"strings"
"github.com/astaxie/beego"
)
type SmtpConf struct {
EnableMail bool
MailNumber int
SmtpUserName string
SmtpHost string
SmtpPassword string
SmtpPort int
FormUserName string
ReplyUserName string
MailExpired int
}
func GetMailConfig() *SmtpConf {
username := beego.AppConfig.String("smtp_user_name")
password := beego.AppConfig.String("smtp_password")
smtpHost := beego.AppConfig.String("smtp_host")
smtpPort := beego.AppConfig.DefaultInt("smtp_port", 25)
formUsername := beego.AppConfig.String("form_user_name")
replyUsername := beego.AppConfig.String("reply_user_name")
enableMail := beego.AppConfig.String("enable_mail")
mailNumber := beego.AppConfig.DefaultInt("mail_number", 5)
c := &SmtpConf{
EnableMail: strings.EqualFold(enableMail, "true"),
MailNumber: mailNumber,
SmtpUserName: username,
SmtpHost: smtpHost,
SmtpPassword: password,
FormUserName: formUsername,
ReplyUserName: replyUsername,
SmtpPort: smtpPort,
}
return c
}