mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-10-16 08:04:10 +00:00
Initial commit
This commit is contained in:
14
common/email.go
Normal file
14
common/email.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package common
|
||||
|
||||
import "gopkg.in/gomail.v2"
|
||||
|
||||
func SendEmail(subject string, receiver string, content string) error {
|
||||
m := gomail.NewMessage()
|
||||
m.SetHeader("From", SMTPAccount)
|
||||
m.SetHeader("To", receiver)
|
||||
m.SetHeader("Subject", subject)
|
||||
m.SetBody("text/html", content)
|
||||
d := gomail.NewDialer(SMTPServer, 587, SMTPAccount, SMTPToken)
|
||||
err := d.DialAndSend(m)
|
||||
return err
|
||||
}
|
Reference in New Issue
Block a user