mail

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SmtpAuthPlain = "PLAIN"
	SmtpAuthLogin = "LOGIN"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EmailClient

type EmailClient struct {
	FromName string
	FromAddr string
	// contains filtered or unexported fields
}

func NewMailer

func NewMailer(host string, port int, username string, password string, tls bool, fromName string, fromAddress string, localName string) *EmailClient

func (*EmailClient) Send

func (c *EmailClient) Send(m *Message) error

type Mailer

type Mailer interface {
	// Send sends an email with the provided Message.
	Send(message *Message) error
}

Mailer defines a base mail client interface.

type Message

type Message struct {
	From        *mail.Address        `json:"from"`
	To          []*mail.Address      `json:"to"`
	Bcc         []*mail.Address      `json:"bcc"`
	Cc          []*mail.Address      `json:"cc"`
	Subject     string               `json:"subject"`
	HTML        string               `json:"html"`
	Text        string               `json:"text"`
	Headers     map[string]string    `json:"headers"`
	Attachments map[string]io.Reader `json:"attachments"`
}

Message defines a generic email message struct.

type SmtpClient

type SmtpClient struct {
	// contains filtered or unexported fields
}

SmtpClient defines a SMTP mail client structure that implements `mailer.Mailer` interface.

func (*SmtpClient) Send

func (c *SmtpClient) Send(m *Message) error

Send implements `mailer.Mailer` interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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