mail

package
v0.0.5-dev Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentType

type ContentType string

ContentType represents the content type of a mail message.

const (
	// ContentTypeTextPlain represents a plain text content type.
	ContentTypeTextPlain ContentType = "text/plain"
	// ContentTypeTextHTML represents a HTML content type.
	ContentTypeTextHTML ContentType = "text/html"
)

type MailConfig

type MailConfig struct {
	From     string
	Username string
	Password string
	Port     int
	Host     string
	ForceTLS bool
}

MailConfig represents the configuration for the mail server.

type MailMessage

type MailMessage struct {
	To          []string
	Subject     string
	ContentType ContentType
	Body        string
}

Mail represents a mail message.

type Mailer

type Mailer struct {
	Config *MailConfig
	Client *mail.Client
}

Mailer represents a mailer client.

func NewMailer

func NewMailer(config *MailConfig) (*Mailer, error)

NewMailer creates a new mailer client and connects to the mail server.

func (*Mailer) Close

func (m *Mailer) Close() error

Close closes the mailer client.

func (*Mailer) SendMail

func (m *Mailer) SendMail(message *MailMessage) error

SendMail sends a given mail message.

func (*Mailer) SendMailWithContext

func (m *Mailer) SendMailWithContext(message *MailMessage, context context.Context) error

SendMailWithContext sends a given mail message with a given context.

Jump to

Keyboard shortcuts

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