emailutils

package
v0.0.0-...-cc3b352 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ConfigKeys = []string{"host", "port", "user", "pass", "use_tls"}
)

Functions

func ReadConfigFile

func ReadConfigFile(cfgFile string) (map[string]string, error)

ReadConfigFile() reads a configuration file using my own fileutils.ReadConfigFile() function.

Types

type EmailHeader

type EmailHeader struct {
	Name    string   // sender's name
	From    string   // sender's email address
	To      []string // recipients' email addresses
	Subject string   // message subject line
}

func (EmailHeader) CheckHeaders

func (hdr EmailHeader) CheckHeaders() error

CheckHeaders() checks to see if the essential headers have values

type EmailMessage

type EmailMessage struct {
	Header EmailHeader
	Body   string
}

func (*EmailMessage) AddRecipient

func (e *EmailMessage) AddRecipient(addr string)

AddRecipient() adds an email address to the EmailHeader.To list

func (*EmailMessage) AddSignature

func (e *EmailMessage) AddSignature(sigStr string)

AddSignature() simply adds a given string to the end of the message. Normally, this string will be a constant in any given program. Usage: emailutils.AddSignature(&msg, "Sig text")

func (*EmailMessage) BodyAppend

func (e *EmailMessage) BodyAppend(text string)

BodyAppend() adds text to any existing text in the main body of the email.

func (*EmailMessage) BodySet

func (e *EmailMessage) BodySet(text string)

BodySet() creates the main text of the email.

func (EmailMessage) HeaderString

func (e EmailMessage) HeaderString() string

HeaderString() creates a single string from the headers.

func (EmailMessage) SendEmail

func (msg EmailMessage) SendEmail(cfg map[string]string) error

SendEmail() does what it says on the tin

func (*EmailMessage) SetSender

func (e *EmailMessage) SetSender(sender string)

SetSender() sets email address of sender

func (*EmailMessage) SetSenderName

func (e *EmailMessage) SetSenderName(name string)

SetSenderName() sets the name string of the sender

func (*EmailMessage) SetSubject

func (e *EmailMessage) SetSubject(subject string)

SetSubject() sets the subject line for the message

Jump to

Keyboard shortcuts

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