mail

package
v0.0.0-...-fd9b66f Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateAnnouncementEmail

func GenerateAnnouncementEmail(option EmailContentAnnouncement) (string, error)

func GenerateReceipt

func GenerateReceipt(option Receipt) (string, error)

func GenerateTransactionalEmail

func GenerateTransactionalEmail(option EmailContentOption) (string, error)

func Init

func Init(dialOptions NewDialerOptions)

func ResetPassword

func ResetPassword(opt ResetPasswordModel) (string, error)

Hermes tempalte reset password

func SendByGoMail

func SendByGoMail(mail Mail) error

func SendMail

func SendMail(message string, mailOpts MailOption) error

func SendMultiMail

func SendMultiMail(message string, mailOpts MultiMailOption) error

Types

type Button

type Button struct {
	Color     string // example: #22BC66
	TextColor string
	Text      string
	Link      string
}

type Data

type Data struct {
	Key   string
	Value string
}

type EmailContentAnnouncement

type EmailContentAnnouncement struct {
	MimeType     MimeType
	Organization string
	Intros       []string
	Greeting     string
	Signature    string
}

type EmailContentOption

type EmailContentOption struct {
	Product     Product
	ClientName  string
	Intros      []string
	Message     string
	Instruction string
	DataTable   [][]Data
	Button      Button
	Outros      []string
	MimeType    MimeType
}

type From

type From struct {
	Name  string
	Email string
}

type Mail

type Mail struct {
	From    string
	To      string
	Subject string
	Message string
}

type MailDialer

type MailDialer struct {
	Host     string
	Port     int
	Username string
	Password string
}

MailDialer may be used if we use our own mail server. Currently we use sendgrid, so this is actually not needed. But we not ditch this code yet since we think we may build our own mail server using postfix later.

type MailOption

type MailOption struct {
	From         string
	To           string
	Cc           string
	Subject      string
	BodyMimeType MimeType
	Attachment   string
	Dialer       MailDialer
	SenderName   string
}

type MimeType

type MimeType string
const (
	MimeTypeHtml MimeType = "text/html"
)

type MultiMailOption

type MultiMailOption struct {
	From
	Subject      string
	To           []*mail.Email
	Cc           []*mail.Email
	BodyMimeType MimeType
}

type NewDialerOptions

type NewDialerOptions struct {
	Host           string
	Port           int
	Username       string
	Password       string
	Auth           smtp.Auth
	SSL            bool
	TLSConfig      *tls.Config
	LocalName      string
	SendGridApiKey string
	Sender         string
	SenderName     string
}

type Product

type Product struct {
	Name string
	Link string
}

type Receipt

type Receipt struct {
	MimeType     MimeType
	URL          string
	CustomerName string
	Organization string
	Intros       []string
	Greeting     string
	Signature    string
	TableData    [][]hermes.Entry
	ActionIntro  string
	ButtonText   string
	ButtonLink   string
}

type ResetPasswordModel

type ResetPasswordModel struct {
	MimeType MimeType
	Hermes   hermes.Hermes
	Email    hermes.Email
}

type Tos

type Tos struct {
	To []From
}

func (*Tos) GenerateMail

func (t *Tos) GenerateMail() []*mail.Email

Jump to

Keyboard shortcuts

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