Skip to content

Commit

Permalink
add the email test
Browse files Browse the repository at this point in the history
  • Loading branch information
luhaoling committed Nov 2, 2023
1 parent 5fad06d commit 1cf98b6
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions pkg/email/mail_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package email

import (
"context"
"fmt"
"github.com/OpenIMSDK/chat/pkg/common/config"
"gopkg.in/yaml.v3"
"io/ioutil"
"log"
"testing"
)

func TestEmail(T *testing.T) {
if err := InitConfig(); err != nil {
panic(err)
}
mail, err := NewMail()
if err != nil {
log.Fatal(err)
}
err = mail.SendMail(context.Background(), "[email protected]", "code")
if err != nil {
log.Fatal(err)
}
fmt.Println("Send Successful")

}

func InitConfig() error {
yam, err := ioutil.ReadFile("config/config.yaml")
if err != nil {
return err
}
err = yaml.Unmarshal(yam, &config.Config)
if err != nil {
return err
}
return nil
}

0 comments on commit 1cf98b6

Please sign in to comment.