gomailer

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 1, 2023 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 EmailMessage

type EmailMessage struct {
	// From is the email address of the sender of the email
	From string
	// To is a slice of email addresses to send the email to
	To []string
	// Subject is the subject of the email
	Subject string
	// Body can be a string (text) or (html)
	Body []byte
}

type EmailOption

type EmailOption struct {
	TemPath     string
	TemData     interface{}
	ContentType string // text/html or text/plain
	Secure      bool
}

EmailOption is used to pass additional options to the email

type GoMailer

type GoMailer interface {
	// SendMail sends an email using the provided message and options
	SendMail(message EmailMessage, options EmailOption) error
	// SendMailWithTemplate sends an email with html template provided
	SendMailWithTemplate(from string, to []string, subject string, options EmailOption) error
}

GoMailer is the interface that wraps the basic SendMail method for sending emails

func New

func New(options GoMailerOption) GoMailer

New returns a new GoMailer instance with the provided options

type GoMailerOption

type GoMailerOption struct {
	// host to use when sending the email
	Host string
	// port to use when sending the email
	Port int
	// username to use when authenticating to the smtp server
	Username string
	// password to use when authenticating to the smtp server
	Password string
}

Jump to

Keyboard shortcuts

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