mailer

package
v1.0.3-0...-714dd1b Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2020 License: Unlicense Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Email

type Email struct {
	FromAddress string
	ToAddress   string
	Subject     string
	Body        string
}

Email has values for From/To/Subject/Body fields

type EmailSender

type EmailSender struct {
	SendMail func(string, smtp.Auth, string, []string, []byte) error
	Server   Provider
	Email    Email
}

EmailSender struct to construct a mailer instance with server/email inputs

func NewEmailSender

func NewEmailSender() *EmailSender

NewEmailSender returns EmailSender struct with smtp.Sendmail

func (EmailSender) SendMessage

func (e EmailSender) SendMessage() error

SendMessage constructs inputs from server/email and send the email message or returns error

type Gmail

type Gmail struct {
	ServerConfig
}

Gmail struct specific to Gmail SMTP

func NewGmail

func NewGmail(s ServerConfig) *Gmail

NewGmail returns Gmail struct with destination address/port

type Provider

type Provider interface {
	GetServer() string
	GetPort() int
	GetFullAddress() string
	GetUsername() string
	GetPassword() string
}

Provider interface interacts with any given sender

type ServerConfig

type ServerConfig struct {
	Address  string
	Port     int
	Username string
	Password string
}

ServerConfig has SMTP config values

func (ServerConfig) GetFullAddress

func (s ServerConfig) GetFullAddress() string

GetFullAddress return full server/port as string

func (ServerConfig) GetPassword

func (s ServerConfig) GetPassword() string

GetPassword returns SMTP password credential

func (ServerConfig) GetPort

func (s ServerConfig) GetPort() int

GetPort returns SMTP port number

func (ServerConfig) GetServer

func (s ServerConfig) GetServer() string

GetServer returns SMTP host/server name

func (ServerConfig) GetUsername

func (s ServerConfig) GetUsername() string

GetUsername returns SMTP username credential

type Yahoo

type Yahoo struct {
	ServerConfig
}

Yahoo struct specific to Yahoo SMTP

func NewYahoo

func NewYahoo(s ServerConfig) *Yahoo

NewYahoo returns Yahoo struct with destination address/port

Jump to

Keyboard shortcuts

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