mail

package
v0.0.0-...-b0ac2f9 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SMTP   = Driver("smtp")
	Custom = Driver("custom")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Name    string
	Address string
}

type Config

type Config struct {
	MailDriver        string
	MailHost          string
	MailPort          int
	MailUser          string
	MailPass          string
	MailSkipTLSVerify bool
}

type Driver

type Driver string

type Mailer

type Mailer interface {
	Send(context.Context, *Message) error
}

type Manager

type Manager interface {
	Mailer
	RegisterDriver(Driver, Mailer) error
	Mailer(Driver) (Mailer, error)
}

func NewManager

func NewManager(cfg Config) Manager

type Message

type Message struct {
	From    Address
	To      []Address
	Subject string
	HTML    string
	Text    string
	Headers map[string]string
}

type SMTPMailer

type SMTPMailer struct {
	Host          string
	Port          int
	Username      string
	Password      string
	SkipTLSVerify bool
}

func NewSMTPMailer

func NewSMTPMailer(cfg Config) *SMTPMailer

func (*SMTPMailer) Send

func (s *SMTPMailer) Send(ctx context.Context, m *Message) error