notify

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package notify allows sending of email and text messages.

Index

Constants

View Source
const (
	ATT     = "att"
	TMOBILE = "tmobile"
	VERIZON = "verizon"
	SPRINT  = "sprint"
)

Notify Constants

Variables

View Source
var (
	SenderConfigFilename = "notify-sender.yaml"
	RxConfigFilename     = "notify-rx.yaml"
)

Config Constants

Functions

This section is empty.

Types

type Notify

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

Notify can send emails to email or phone number recipients

func NewNotify

func NewNotify(host string, port int, user string, password string) *Notify

NewNotify creates a new Notify

func (*Notify) SendEmail

func (n *Notify) SendEmail(to []string, subject string, body string, filenamesAttach []string, filenamesEmbed []string)

SendEmail sends an email with attachments

func (*Notify) SendText

func (n *Notify) SendText(phones []Phone, subject string, body string, filenames []string)

SendText sends a text message with attachments Note: text messages tend to be slower as the target service provider decides

when to relay messages from email to mobile devices.

type Phone

type Phone struct {
	Number   string
	Provider string
}

Phone contains phone information

func NewPhone

func NewPhone(number string, provider string) *Phone

NewPhone creates a new Phone

type RxConfig

type RxConfig struct {
	Email []string  `yaml:"email,omitempty"`
	Text  SmsConfig `yaml:"sms"`
}

RxConfig contains parameters for notifier receivers

func NewRxConfig

func NewRxConfig(configPath string) *RxConfig

NewRxConfig returns a new RxConfig

func (*RxConfig) GetPhones

func (c *RxConfig) GetPhones() []Phone

GetPhones returns a slice of Phone

type SenderConfig

type SenderConfig struct {
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	User     string `yaml:"user"`
	Password string `yaml:"password"`
}

SenderConfig contains parameters for notify sender

func NewSenderConfig

func NewSenderConfig(configPath string) *SenderConfig

NewSenderConfig creates a new SenderConfig

type SmsConfig

type SmsConfig struct {
	Verizon []string `yaml:"verizon,omitempty"`
	Att     []string `yaml:"att,omitempty"`
	Tmobile []string `yaml:"tmobile,omitempty"`
}

SmsConfig contains parameters for sms phone numbers

Jump to

Keyboard shortcuts

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