mailer

package module
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: Apache-2.0 Imports: 27 Imported by: 5

README

CI PkgGoDev

mailer

Email sender using mailgun

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadFile

func DownloadFile(srvDrive *drive.Service, docId, filename string) error

func ExportPDF

func ExportPDF(srvDrive *drive.Service, docId, filename string) error

func RunCampaigns added in v0.0.14

func RunCampaigns(ctx context.Context, dcs ...*DripCampaign) error

Types

type CampaignStep added in v0.0.4

type CampaignStep struct {
	WaitTime          time.Duration
	WeekendAdjustment timex.WeekendAdjustment
	Mailer            Mailer
}

type Contact added in v0.0.4

type Contact struct {
	Email                   string    `csv:"email"`
	Data                    string    `csv:"data"` // json format
	Stop                    bool      `csv:"stop"`
	Step_0_Timestamp        Timestamp `csv:"s0_timestamp"`
	Step_0_WaitForCondition bool      `csv:"s0_wait_for_cond"`
	Step_0_Done             bool      `csv:"s0_done"`
	Step_1_Timestamp        Timestamp `csv:"s1_timestamp"`
	Step_1_WaitForCondition bool      `csv:"s1_wait_for_cond"`
	Step_1_Done             bool      `csv:"s1_done"`
	Step_2_Timestamp        Timestamp `csv:"s2_timestamp"`
	Step_2_WaitForCondition bool      `csv:"s2_wait_for_cond"`
	Step_2_Done             bool      `csv:"s2_done"`
	Step_3_Timestamp        Timestamp `csv:"s3_timestamp"`
	Step_3_WaitForCondition bool      `csv:"s3_wait_for_cond"`
	Step_3_Done             bool      `csv:"s3_done"`
	Step_4_Timestamp        Timestamp `csv:"s4_timestamp"`
	Step_4_WaitForCondition bool      `csv:"s4_wait_for_cond"`
	Step_4_Done             bool      `csv:"s4_done"`
}

type DripCampaign added in v0.0.4

type DripCampaign struct {
	Name  string
	Steps []CampaignStep

	M             *SMTPService
	SheetService  *sheets.Service
	SpreadsheetId string
	SheetName     string
}

func (*DripCampaign) AddContact added in v0.0.4

func (dc *DripCampaign) AddContact(c Contact) error

func (*DripCampaign) ListAudiences added in v0.0.13

func (dc *DripCampaign) ListAudiences() (sets.String, error)

func (*DripCampaign) Prepare added in v0.0.4

func (dc *DripCampaign) Prepare(c *Contact, t time.Time)

func (*DripCampaign) ProcessCampaign added in v0.0.4

func (dc *DripCampaign) ProcessCampaign() error

type Mailer

type Mailer struct {
	Sender  string
	BCC     string
	ReplyTo string

	Subject   string
	Body      string
	Plaintext bool
	Params    interface{}

	AttachmentBytes map[string][]byte
	GDriveFiles     map[string]string
	GoogleDocIds    map[string]string
}

func (*Mailer) Render added in v0.0.11

func (m *Mailer) Render() (subject string, bodyText string, bodyHtml string, err error)

func (*Mailer) SendMail

func (m *Mailer) SendMail(mg *SMTPService, recipient, cc string, srv *drive.Service) error

type SMTPService added in v0.0.17

type SMTPService struct {
	Address string
	Auth    smtp.Auth
}

func NewSMTPServiceFromEnv added in v0.0.18

func NewSMTPServiceFromEnv() (*SMTPService, error)

type Timestamp added in v0.0.4

type Timestamp struct {
	time.Time
}

func (*Timestamp) MarshalCSV added in v0.0.4

func (date *Timestamp) MarshalCSV() (string, error)

func (*Timestamp) String added in v0.0.4

func (date *Timestamp) String() string

func (*Timestamp) UnmarshalCSV added in v0.0.4

func (date *Timestamp) UnmarshalCSV(csv string) (err error)

Jump to

Keyboard shortcuts

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