package aws_test import ( "context" "testing" "code.yun.ink/pkg/mailx" "code.yun.ink/pkg/mailx/aws" ) // https://ap-northeast-1.console.aws.amazon.com/ses/home?region=ap-northeast-1#/identities func TestSend(t *testing.T) { if testing.Short() { t.Skip("skip real send in short mode") } client := aws.New(aws.Config{ AccessKeyID: "AKIAU6GD3MNRHKR4RZG5", AccessKeySecret: "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", Region: "ap-northeast-1", Sender: "chenlihan@dreaminglife.cn", }) ctx := context.Background() err := client.Send(ctx, mailx.NewMessage(). From("chenlihan@dreaminglife.cn"). To("huangxinyun@dreaminglife.cn"). Subject("主题"). Body("Hello"). Build()) if err != nil { t.Fatal(err) } t.Log("send success") }