mailmerge

package
v0.6.9 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ColumnTo   = "TO"
	ColumnCc   = "CC"
	ColumnBcc  = "BCC"
	ColumnFrom = "FROM" // can be "me"

)

Variables

View Source
var ErrMailMergeOptsCannotBeNil = errors.New("parameter MailMergeOpts cannot be nil")

Functions

func ExecMailMergeCLI

func ExecMailMergeCLI(ctx context.Context) (int, error)

Types

type MailMerge

type MailMerge struct {
	BodyTemplateSet *mustacheutil.MustacheSet
	Table           *table.Table
	CommonPartsSet  multipartutil.PartsSet
	GmailService    *gmailutil.GmailService
}

func NewMailMerge

func NewMailMerge(ctx context.Context, opts *MailMergeOpts) (*MailMerge, error)

func (*MailMerge) Messages

func (mm *MailMerge) Messages() ([]mailutil.MessageWriter, error)

func (*MailMerge) Send

func (mm *MailMerge) Send(ctx context.Context, userID string) (int, error)

type MailMergeOpts

type MailMergeOpts struct {
	GoauthCredsFile                 string   `short:"c" long:"goauth-credentials-file" description:"The Google Sheet ID" required:"true"`
	GoauthAccountKey                string   `short:"k" long:"goauth-account-key" description:"The Google Sheet ID"`
	RecipientsGoogleSheetID         string   `short:"s" long:"sheet-id" description:"The Google Sheet ID"`
	RecipientsGoogleSheetIndex      uint     `short:"x" long:"sheet-index" description:"The Google Sheet Index"`
	RecipientsGoogleSheetHeaderRows uint32   `short:"r" long:"sheet-header-row-count" description:"The Google Sheet header row count"`
	SubjectTemplateTextFilename     string   `short:"j" long:"subject-template" description:"Subject template"`
	BodyTemplateHTMLFilename        string   `long:"html-template" description:"Body tmeplate for HTML"`
	BodyTemplateTextFilename        string   `short:"t" long:"text-template" description:"Body template for text"`
	InlineFilenames                 []string `short:"i" long:"inline-filename" description:"Inline filenames"`
	AttachmentsFilenames            []string `short:"a" long:"attachment-filename" description:"Filenames as attachments"`

	GoogleClient       *http.Client
	BodyCommonPartsSet multipartutil.PartsSet
}

func (MailMergeOpts) Validate

func (opts MailMergeOpts) Validate() error

Jump to

Keyboard shortcuts

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