mailer

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mailer

type Mailer interface {
	// Send sends an email with HTML body to the specified recipient.
	Send(
		fromEmail mail.Address,
		toEmail mail.Address,
		subject string,
		htmlContent string,
		attachments map[string]io.Reader,
	) error
}

Mailer defines a base mail client interface.

type Sendmail

type Sendmail struct {
}

Sendmail implements `mailer.Mailer` interface and defines a mail client that sends emails via the `sendmail` *nix command.

This client is usually recommended only for development and testing.

func (*Sendmail) Send

func (m *Sendmail) Send(
	fromEmail mail.Address,
	toEmail mail.Address,
	subject string,
	htmlContent string,
	attachments map[string]io.Reader,
) error

Send implements `mailer.Mailer` interface.

Attachments are currently not supported.

type SmtpClient

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

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

func NewSmtpClient

func NewSmtpClient(
	host string,
	port int,
	username string,
	password string,
	tls bool,
) *SmtpClient

NewSmtpClient creates new `SmtpClient` with the provided configuration.

func (*SmtpClient) Send

func (m *SmtpClient) Send(
	fromEmail mail.Address,
	toEmail mail.Address,
	subject string,
	htmlContent string,
	attachments map[string]io.Reader,
) error

Send implements `mailer.Mailer` interface.

Jump to

Keyboard shortcuts

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