github.com/infraboard/keyauth@v0.8.1/apps/system/notify/mail/mail_test.go (about) 1 package mail_test 2 3 import ( 4 "testing" 5 6 "github.com/infraboard/keyauth/apps/system/notify" 7 "github.com/infraboard/keyauth/apps/system/notify/mail" 8 "github.com/stretchr/testify/assert" 9 ) 10 11 func TestSendMail(t *testing.T) { 12 should := assert.New(t) 13 conf, err := mail.LoadConfigFromEnv() 14 if should.NoError(err) { 15 sd, err := mail.NewSender(conf) 16 if should.NoError(err) { 17 req := notify.NewSendMailRequest() 18 req.To = "719118794@qq.com" 19 req.Subject = "欢迎使用" 20 req.Content = "请不要回复" 21 should.NoError(sd.Send(req)) 22 } 23 } 24 }