mailer

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAlreadyRunning

func IsAlreadyRunning(err error) bool

IsAlreadyRunning checks if the error cause is an alreadyRunning error returned if someone tries to start multiple daemons

func IsNotRunning

func IsNotRunning(err error) bool

IsNotRunning checks if the error cause is a notRunning error returned if someone tries to send a message but mailer daemon is not running

Types

type Config

type Config struct {
	Server   string
	Port     int
	User     string
	Password string

	From    string
	To      string
	Subject string
}

Config struct encapsulate all settings for TextMailer

type TextMailer

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

TextMailer implements Mailer interface it runs a daemon waiting for text messages to send to a predefined address

func New

func New(cfg Config) *TextMailer

New returns a Mailer implementation

func (*TextMailer) Run

func (mailer *TextMailer) Run(stop <-chan struct{}) error

Run starts the mailer daemon

func (*TextMailer) SendMessage

func (mailer *TextMailer) SendMessage(contentType, messageText string) error

SendMessage prepares new messages and sends them Caller is responsible for proper escaping of message in case of e.g. HTML

Jump to

Keyboard shortcuts

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