From 139330aee27c570904b763bc52cca7468e1a8f2c Mon Sep 17 00:00:00 2001 From: Yun Date: Sat, 30 Aug 2025 18:14:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aliyun/aliyun.go | 2 +- aws/aws.go | 2 +- cmd/main.go | 16 ++++++++++++++-- mailgun/mailgun.go | 2 +- smtp/smtp.go | 2 +- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/aliyun/aliyun.go b/aliyun/aliyun.go index 86980a5..c9063c2 100644 --- a/aliyun/aliyun.go +++ b/aliyun/aliyun.go @@ -25,7 +25,7 @@ type Aliyun struct { func NewAliyun() *Aliyun { aliyun := &Aliyun{} aliyun.Options = interfaces.DefaultOptions() - aliyun.EmailType = "Aliyun" + aliyun.EmailType = interfaces.EmailTypeAliyun return aliyun } diff --git a/aws/aws.go b/aws/aws.go index ff56aaf..108ebcf 100644 --- a/aws/aws.go +++ b/aws/aws.go @@ -21,7 +21,7 @@ type Aws struct { func NewAws() *Aws { aws := &Aws{} aws.Options = interfaces.DefaultOptions() - aws.EmailType = "Aws" + aws.EmailType = interfaces.EmailTypeAws return aws } diff --git a/cmd/main.go b/cmd/main.go index 04abbfa..4983197 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -18,10 +18,22 @@ func main() { panic(err) } // 使用em进行后续操作 - em.SetOption(ctx, interfaces.SetSmtp(&interfaces.EmailConfigDataSmtp{})) + 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: "", + Form: "yun@blueoceanpay.com", + To: []string{"995116474@qq.com"}, + Subject: "Test Email", + Body: "Hello, this is a test email.", }) if err != nil { panic(err) diff --git a/mailgun/mailgun.go b/mailgun/mailgun.go index f88b146..8a7ebd4 100644 --- a/mailgun/mailgun.go +++ b/mailgun/mailgun.go @@ -18,7 +18,7 @@ type MailGun struct { func NewMailGun() *MailGun { mailgun := &MailGun{} mailgun.Options = interfaces.DefaultOptions() - mailgun.EmailType = "MailGun" + mailgun.EmailType = interfaces.EmailTypeMailgun return mailgun } diff --git a/smtp/smtp.go b/smtp/smtp.go index 065b597..aa71910 100644 --- a/smtp/smtp.go +++ b/smtp/smtp.go @@ -29,7 +29,7 @@ type Smtp struct { func NewSmtp() *Smtp { smtp := &Smtp{} smtp.Options = interfaces.DefaultOptions() - smtp.EmailType = "Smtp" + smtp.EmailType = interfaces.EmailTypeSmtp return smtp }