Files
mailx/aws/aws_test.go
T

36 lines
782 B
Go
Raw Normal View History

2024-11-20 19:42:07 +08:00
package aws_test
import (
"context"
"testing"
2026-08-15 01:38:05 +08:00
"code.yun.ink/pkg/mailx"
2024-11-20 19:42:07 +08:00
"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) {
2026-08-15 01:38:05 +08:00
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",
})
2025-08-10 21:17:10 +08:00
2024-11-20 19:42:07 +08:00
ctx := context.Background()
2026-08-15 01:38:05 +08:00
err := client.Send(ctx, mailx.NewMessage().
From("chenlihan@dreaminglife.cn").
To("huangxinyun@dreaminglife.cn").
Subject("主题").
Body("Hello").
Build())
2024-11-20 19:42:07 +08:00
if err != nil {
t.Fatal(err)
}
t.Log("send success")
}