You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
851 B
33 lines
851 B
package email
|
|
|
|
/*
|
|
系统描述:邮件系统,现支持qq邮箱以及gmail邮箱的邮件发送
|
|
*/
|
|
type (
|
|
ISys interface {
|
|
SendMail(title, content string, to ...string) error
|
|
SendMailForFile(title string, content string, filepath string, filename string, to ...string) (err error)
|
|
}
|
|
)
|
|
|
|
var (
|
|
defsys ISys
|
|
)
|
|
|
|
func OnInit(config map[string]interface{}, option ...Option) (err error) {
|
|
defsys, err = newSys(newOptions(config, option...))
|
|
return
|
|
}
|
|
|
|
func NewSys(option ...Option) (sys ISys, err error) {
|
|
sys, err = newSys(newOptionsByOption(option...))
|
|
return
|
|
}
|
|
|
|
func SendMail(title, content string, to ...string) error {
|
|
return defsys.SendMail(title, content, to...)
|
|
}
|
|
|
|
func SendMailForFile(title, content string, filepath string, filename string, to ...string) error {
|
|
return defsys.SendMailForFile(title, content, filepath, filename, to...)
|
|
}
|
|
|