email

package
v0.1.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2025 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AliyunConfig

type AliyunConfig struct {
	ID      string
	Secret  string
	Account string
}

AliyunConfig holds the configuration for Aliyun DirectMail

type AliyunSender

type AliyunSender struct {
	Config *AliyunConfig
}

AliyunSender implements EmailSender for Aliyun

func (*AliyunSender) SendTemplateEmail

func (s *AliyunSender) SendTemplateEmail(recipientEmail string, template Template) (string, error)

type Config

type Config any

Config is a generic email configuration interface

type Email

type Email struct {
	Provider     string              `json:"provider" yaml:"provider"`
	Mailgun      *MailgunConfig      `json:"mailgun" yaml:"mailgun"`
	Aliyun       *AliyunConfig       `json:"aliyun" yaml:"aliyun"`
	NetEase      *NetEaseConfig      `json:"netease" yaml:"netease"`
	SendGrid     *SendGridConfig     `json:"sendgrid" yaml:"sendgrid"`
	SMTP         *SMTPConfig         `json:"smtp" yaml:"smtp"`
	TencentCloud *TencentCloudConfig `json:"tencent_cloud" yaml:"tencent_cloud"`
}

Email holds the configuration for all email providers

type LocalSMTPSender

type LocalSMTPSender struct {
	Config *SMTPConfig
}

LocalSMTPSender implements EmailSender for local SMTP

func (*LocalSMTPSender) SendTemplateEmail

func (s *LocalSMTPSender) SendTemplateEmail(recipientEmail string, template Template) (string, error)

type MailgunConfig

type MailgunConfig struct {
	Key    string
	Domain string
	From   string
}

MailgunConfig holds the configuration for Mailgun

type MailgunSender

type MailgunSender struct {
	Config *MailgunConfig
}

MailgunSender implements EmailSender for Mailgun

func (*MailgunSender) SendTemplateEmail

func (s *MailgunSender) SendTemplateEmail(recipientEmail string, template Template) (string, error)

type NetEaseConfig

type NetEaseConfig struct {
	Username string
	Password string
	From     string
	SMTPHost string
	SMTPPort string
}

NetEaseConfig holds the configuration for NetEase Enterprise Email

type NetEaseSender

type NetEaseSender struct {
	Config *NetEaseConfig
}

NetEaseSender implements EmailSender for NetEase

func (*NetEaseSender) SendTemplateEmail

func (s *NetEaseSender) SendTemplateEmail(recipientEmail string, template Template) (string, error)

type SMTPConfig

type SMTPConfig struct {
	SMTPHost string
	SMTPPort string
	Username string
	Password string
	From     string
}

SMTPConfig holds the configuration for local email sending

type SendGridConfig

type SendGridConfig struct {
	Key  string
	From string
}

SendGridConfig holds the configuration for SendGrid

type SendGridSender

type SendGridSender struct {
	Config *SendGridConfig
}

SendGridSender implements EmailSender for SendGrid

func (*SendGridSender) SendTemplateEmail

func (s *SendGridSender) SendTemplateEmail(recipientEmail string, template Template) (string, error)

type Sender

type Sender interface {
	SendTemplateEmail(recipientEmail string, template Template) (string, error)
}

Sender is a generic interface for sending emails

func NewSender

func NewSender(config Config) (Sender, error)

NewSender returns a new Sender

type Template

type Template struct {
	Subject  string `json:"subject"`
	Template string `json:"template"`
	Keyword  string `json:"keyword"`
	URL      string `json:"url"`
	Data     any    `json:"data"`
}

Template represents the email template

type TencentCloudConfig

type TencentCloudConfig struct {
	ID     string
	Secret string
	From   string
}

TencentCloudConfig holds the configuration for Tencent Cloud Simple Email Service

type TencentCloudSender

type TencentCloudSender struct {
	Config *TencentCloudConfig
}

TencentCloudSender implements EmailSender for Tencent Cloud

func (*TencentCloudSender) SendTemplateEmail

func (s *TencentCloudSender) SendTemplateEmail(recipientEmail string, template Template) (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL