Documentation ¶
Index ¶
- Variables
- func ReadConfigFile(cfgFile string) (map[string]string, error)
- type EmailHeader
- type EmailMessage
- func (e *EmailMessage) AddRecipient(addr string)
- func (e *EmailMessage) AddSignature(sigStr string)
- func (e *EmailMessage) BodyAppend(text string)
- func (e *EmailMessage) BodySet(text string)
- func (e EmailMessage) HeaderString() string
- func (msg EmailMessage) SendEmail(cfg map[string]string) error
- func (e *EmailMessage) SetSender(sender string)
- func (e *EmailMessage) SetSenderName(name string)
- func (e *EmailMessage) SetSubject(subject string)
Constants ¶
This section is empty.
Variables ¶
var (
ConfigKeys = []string{"host", "port", "user", "pass", "use_tls"}
)
Functions ¶
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