mail

package
v0.0.0-...-db4472a Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BodyType

type BodyType int

BodyType is used to specify the format of the body.

const (
	// PlainText is used to specify that the body is plain text.
	PlainText BodyType = iota
	// HTML is used to specify that the body is HTML.
	HTML
)

type Mail

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

Mail struct holds necessary data to send emails.

func New

func New(senderAddress, smtpHostAddress string) *Mail

New returns a new instance of a Mail notification service.

func (*Mail) AddReceivers

func (m *Mail) AddReceivers(addresses ...string)

AddReceivers takes email addresses and adds them to the internal address list. The Send method will send a given message to all those addresses.

func (*Mail) AuthenticateSMTP

func (m *Mail) AuthenticateSMTP(identity, userName, password, host string)

AuthenticateSMTP authenticates you to send emails via smtp. Example values: "", "test@gmail.com", "password123", "smtp.gmail.com" For more information about smtp authentication, see here:

-> https://pkg.go.dev/net/smtp#PlainAuth

func (*Mail) BodyFormat

func (m *Mail) BodyFormat(format BodyType)

BodyFormat can be used to specify the format of the body. Default BodyType is HTML.

func (Mail) Send

func (m Mail) Send(ctx context.Context, subject, message string) error

Send takes a message subject and a message body and sends them to all previously set chats. Message body supports html as markup language.

Jump to

Keyboard shortcuts

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