20 Star 165 Fork 27

qiqi/orange

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
init.go 752 Bytes
一键复制 编辑 原始数据 按行查看 历史
qiqi 提交于 2020-01-25 01:19 . 添加邮件发送工具
package mailer
import (
"gitee.com/zhucheer/orange/cfg"
"errors"
)
func NewMailer(optionName string) (mailer *sendMail, err error){
options:=cfg.Config.Exists("mailer."+optionName)
if options == false{
return nil, errors.New("not found mailer config by "+ optionName+"")
}
host:=cfg.Config.GetString("mailer."+optionName+".host")
port:=cfg.Config.GetInt("mailer."+optionName+".port")
username:=cfg.Config.GetString("mailer."+optionName+".username")
password:=cfg.Config.GetString("mailer."+optionName+".password")
openTsl:=cfg.Config.GetBool("mailer."+optionName+".tsl")
mailerOption:=Mailer{
Host:host,
Port:port,
UserName:username,
Password:password,
OpenTsl:openTsl,
}
mailer,err= GetSendMailer(mailerOption)
return
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/zhucheer/orange.git
git@gitee.com:zhucheer/orange.git
zhucheer
orange
orange
v0.2.5

搜索帮助