mail

package
v1.1.19 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Default

func Default(cfg Config, templateEngine *render.HtmlEngine)

func Html

func Html(view string, body utils.H) string

func Queue

func Queue(msg Mail, queue *mail.Queue) error

func Send

func Send(msg Mail) error

func SendMail

func SendMail(msg Mail) error

Types

type Application

type Application struct {
	Mailer *Mailer
}

func (*Application) Init

func (app *Application) Init() *Mailer

type Attachment

type Attachment struct {
	Data     []byte
	File     string
	FileName string
	MimeType string
}

type Body

type Body struct {
	Content string
	// contains filtered or unexported fields
}

func View

func View(view string, body utils.H) *Body

func (*Body) Queue

func (t *Body) Queue(msg Mail, queue *mail.Queue) error

func (*Body) Send

func (t *Body) Send(msg Mail) error

type Config

type Config struct {
	Host         string `json:"host" yaml:"host" env:"MAIL_HOST"`
	Username     string `json:"username" yaml:"username" env:"MAIL_USERNAME"`
	Password     string `json:"password" yaml:"password" env:"MAIL_PASSWORD"`
	Encryption   string `json:"encryption" yaml:"encryption" env:"MAIL_ENCRYPTION"`
	FromAddress  string `json:"from_address" yaml:"from_address" env:"MAIL_FROM_ADDRESS"`
	AwsAccessKey string `json:"aws_access_key"`
	AwsSecretKey string `json:"aws_secret_key"`
	FromName     string `json:"from_name" yaml:"from_name" env:"MAIL_FROM_NAME"`
	EmailLayout  string `json:"layout" yaml:"layout" env:"MAIL_LAYOUT"`
	Port         int    `json:"port" yaml:"port" env:"MAIL_PORT"`
	Charset      string `json:"charset"`
	Region       string `json:"region"`
}

func GetMailConfig

func GetMailConfig() Config

type Mail

type Mail struct {
	To          []string     `json:"to,omitempty"`
	From        string       `json:"from,omitempty"`
	Subject     string       `json:"subject,omitempty"`
	Body        string       `json:"body,omitempty"`
	Bcc         []string     `json:"bcc,omitempty"`
	Cc          []string     `json:"cc,omitempty"`
	Attachments []Attachment `json:"attachments,omitempty"`
	AttachFiles []Attachment `json:"attach_files"`
	// contains filtered or unexported fields
}

type Mailer

type Mailer struct {
	*sMail.SMTPServer
	*sMail.SMTPClient
	*render.HtmlEngine
	Config Config
}
var DefaultMailer *Mailer

func New

func New(cfg Config, templateEngine *render.HtmlEngine) *Mailer

func (*Mailer) Html

func (m *Mailer) Html(view string, body utils.H) string

func (*Mailer) Queue

func (m *Mailer) Queue(msg Mail, queue *mail.Queue) error

func (*Mailer) Send

func (m *Mailer) Send(msg Mail) error

func (*Mailer) View

func (m *Mailer) View(view string, body utils.H) *Body

type SendMailJob

type SendMailJob struct {
}

func (*SendMailJob) Handle

func (r *SendMailJob) Handle(args ...any) error

Handle Execute the job.

func (*SendMailJob) Signature

func (r *SendMailJob) Signature() string

Signature The name and signature of the job.

type ServiceProvider

type ServiceProvider struct {
	Mailer *Mailer
}

func (*ServiceProvider) Boot

func (route *ServiceProvider) Boot()

func (*ServiceProvider) Register

func (route *ServiceProvider) Register()

Jump to

Keyboard shortcuts

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