调整接口
This commit is contained in:
+10
-15
@@ -2,30 +2,25 @@ package aliyun_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"code.yun.ink/pkg/mailx/aliyun"
|
||||
"code.yun.ink/pkg/mailx/interfaces"
|
||||
"github.com/yuninks/loggerx"
|
||||
)
|
||||
|
||||
func TestSend(t *testing.T) {
|
||||
aliyun := &aliyun.Aliyun{}
|
||||
aliyun := aliyun.NewAliyun()
|
||||
ctx := context.Background()
|
||||
|
||||
logger := loggerx.NewLogger(ctx)
|
||||
ali, err := aliyun.SetOption(ctx, interfaces.SetAliyun(&interfaces.EmialConfigDataAliyun{
|
||||
AccessId: "LTAI5tEQ8L8fmDir8udD3CFr",
|
||||
AccessKey: "llg9M1U56s2SW5PuerlKPvTB1xYhn0",
|
||||
Endpoint: "dm.aliyuncs.com",
|
||||
AccountName: "test@email.aisz.org", //"test@email.aisz.org",
|
||||
ReplyAddress: "287852692@qq.com",
|
||||
}))
|
||||
|
||||
ali, err := aliyun.InitEmail(ctx, interfaces.EmailConfigData{
|
||||
Aliyun: &interfaces.EmialConfigDataAliyun{
|
||||
AccessId: "LTAI5tEQ8L8fmDir8udD3CFr",
|
||||
AccessKey: "llg9M1U56s2SW5PuerlKPvTB1xYhn0",
|
||||
Endpoint: "dm.aliyuncs.com",
|
||||
AccountName: "test@email.aisz.org", //"test@email.aisz.org",
|
||||
ReplyAddress: "287852692@qq.com",
|
||||
},
|
||||
}, logger)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -35,10 +30,10 @@ func TestSend(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
fmt.Println(string(by))
|
||||
t.Log(string(by))
|
||||
|
||||
err = ali.Send(ctx, interfaces.Message{
|
||||
To: []string{"huangxinyun@dreaminglife.cn"},
|
||||
To: []string{"995116474@qq.com"},
|
||||
Subject: "测试主题",
|
||||
Body: string(by),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user