email

package
v0.0.0-...-5e9c0d7 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credentials

type Credentials struct {
	Username   string // "from@yandex.ru"
	Password   string // "token app"
	ServerName string // "smtp.yandex.ru:465"
	Identity   string // ""
}

MailBean - all settings for email package in Bean-like struct

type MailBean

type MailBean struct {
	Subj string
	Credentials
	EnableNotify bool
	// contains filtered or unexported fields
}

MailBean - all settings for email package in Bean-like struct

func NewMailBean

func NewMailBean(log logrus.FieldLogger, from mail.Address, to []mail.Address, subj string, creds Credentials, enableNotify bool) *MailBean

func (*MailBean) SendEmails

func (m *MailBean) SendEmails(body string) error

SendEmails - send email with default template @see email.emailTemplate const

Example
Credentials := Credentials{"username", "password", "smtp.test.com:465", ""}
Email := NewMailBean(nil, mail.Address{Name: "I", Address: "from@test.com"}, []mail.Address{{Name: "YOU", Address: "to@test.com"}}, "Subj mail", Credentials, true)
//Email.SetFromAndToEmailAddresses(mail.Address{Name: "I", Address: "from@test.com"}, []mail.Address{{Name: "YOU", Address: "to@test.com"}})
_ = Email.SendEmails("Body text of Email")
Output:

func (*MailBean) SetFromAndToEmailAddresses

func (m *MailBean) SetFromAndToEmailAddresses(from mail.Address, to []mail.Address)

SetFromAndToEmailAddresses - set from and to email addresses

Jump to

Keyboard shortcuts

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