Files
2025-08-30 18:14:09 +08:00

43 lines
770 B
Go

package main
import (
"context"
"code.yun.ink/pkg/mailx"
"code.yun.ink/pkg/mailx/interfaces"
)
func main() {
ctx := context.Background()
ch := mailx.Platform
em, err := ch.GetEmail(interfaces.EmailTypeSmtp)
if err != nil {
panic(err)
}
// 使用em进行后续操作
em,err = em.SetOption(ctx, interfaces.SetSmtp(&interfaces.EmailConfigDataSmtp{
Username: "support@email.blueoceanpay.com",
Password: "SupporT2017",
ReplyTo: "",
Host: "smtpdm-ap-southeast-1.aliyun.com",
Port: "80",
}))
if err != nil {
panic(err)
}
err = em.Send(ctx, interfaces.Message{
Form: "yun@blueoceanpay.com",
To: []string{"995116474@qq.com"},
Subject: "Test Email",
Body: "Hello, this is a test email.",
})
if err != nil {
panic(err)
}
}