emailUtils

package
v0.0.0-...-e2c1db5 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2015 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EMAIL_PROVIDER_TYPE__DEFAULT  = 1 << iota
	EMAIL_PROVIDER_TYPE__SENDGRID = 1 << iota
)
View Source
const (
	MAIL_QUEUE__TABLE_NAME                   = "queued_email"
	MAIL_QUEUE__COLUMN__SEND_DUE_TIME        = "SendDueTime"
	MAIL_QUEUE__COLUMN__SUCCESSFULLY_SENT_ON = "SuccessfullySentOn"
	MAIL_QUEUE__COLUMN__SEND_ERROR           = "SendError"
)

Variables

This section is empty.

Functions

func CreateFieldsToLoadInQueuedEmail

func CreateFieldsToLoadInQueuedEmail() *RelatedFieldsToLoad

func EnqueueEmail

func EnqueueEmail(
	sendGridAdvancedSuppressionManagerGroup int,
	viewData iEmailView,
	emailContext *EmailContext,
	scheduleSendMailNow bool,
	sendDueTime time.Time,
	to []*EmailRecipient,
	from *EmailRecipient,
	subject string,
	msgType IEmailMessageType,
	debugInfo string,
	attachments ...*EmailAttachment)

func EnqueueEmail_AndSendNow

func EnqueueEmail_AndSendNow(
	sendGridAdvancedSuppressionManagerGroup int,
	viewData iEmailView,
	emailContext *EmailContext,
	to []*EmailRecipient,
	from *EmailRecipient,
	subject string,
	msgType IEmailMessageType,
	debugInfo string,
	attachments ...*EmailAttachment)

func FlushEmailQueueSynchronously

func FlushEmailQueueSynchronously()

func RenderGoangi2Email

func RenderGoangi2Email(templatePath string, emailDataObject map[interface{}]interface{}) string

func ScheduleSendMailNow

func ScheduleSendMailNow()

func StartContinualEmailQueueSender

func StartContinualEmailQueueSender(emailContext *EmailContext)

Types

type EmailAttachment

type EmailAttachment struct {
	Filename string
	Data     []byte
	Inline   bool
}

func CreateNewEmailAttachment

func CreateNewEmailAttachment(fileName string, data []byte) *EmailAttachment

type EmailContext

type EmailContext struct {
	Logger ILogger
	// contains filtered or unexported fields
}
var DefaultEmailContext *EmailContext

func CreateEmailContext_DefaultEmailProvider

func CreateEmailContext_DefaultEmailProvider(logger ILogger, authUsername, authPassword, mailHostAndPort string, queueSendingIntervalMinutes int, doNotReplyFrom, adminRecipient, supportRecipient *EmailRecipient) *EmailContext

func CreateEmailContext_SendGridProvider

func CreateEmailContext_SendGridProvider(logger ILogger, sendgridApiUser, sendgridApiKey, sendgridTemplateId string, doNotReplyFrom, adminRecipient, supportRecipient *EmailRecipient) *EmailContext

func (*EmailContext) GetAdminRecipient

func (this *EmailContext) GetAdminRecipient() *EmailRecipient

func (*EmailContext) GetDoNotReplyFrom

func (this *EmailContext) GetDoNotReplyFrom() *EmailRecipient

func (*EmailContext) GetQueueSendingInterval

func (this *EmailContext) GetQueueSendingInterval() time.Duration

func (*EmailContext) GetSupportRecipient

func (this *EmailContext) GetSupportRecipient() *EmailRecipient

func (*EmailContext) IsSendGridEmailProvider

func (this *EmailContext) IsSendGridEmailProvider() bool
type EmailLink struct {
	BeforeLinkText        string
	LinkText              string
	AfterLinkText         string
	Href                  string
	TargetAttribute       string
	StyleAttributeContent string
}
func CreateEmailLink(beforeLinkText, linkText, afterLinkText, href, targetAttribute, styleAttributeContent string) *EmailLink

func (*EmailLink) GetAfterLinkText

func (this *EmailLink) GetAfterLinkText() string

func (*EmailLink) GetBeforeLinkText

func (this *EmailLink) GetBeforeLinkText() string

func (*EmailLink) GetHref

func (this *EmailLink) GetHref() string

func (*EmailLink) GetLinkText

func (this *EmailLink) GetLinkText() string

func (*EmailLink) GetStyleAttributeContent

func (this *EmailLink) GetStyleAttributeContent() string

func (*EmailLink) GetTargetAttribute

func (this *EmailLink) GetTargetAttribute() string

type EmailMessage

type EmailMessage struct {
	To          []*EmailRecipient
	From        *EmailRecipient
	Subject     string
	Body        string
	Type        IEmailMessageType
	Attachments []*EmailAttachment
	SendDueTime time.Time
	DebugInfo   string
}

func CreateEmailMessage

func CreateEmailMessage(sendDueTime time.Time, to []*EmailRecipient, from *EmailRecipient, subject, body string, msgType IEmailMessageType, debugInfo string, attachments ...*EmailAttachment) *EmailMessage

func (*EmailMessage) Enqueue

func (this *EmailMessage) Enqueue(emailContext *EmailContext, scheduleSendMailNow bool, sendGridAdvancedSuppressionManagerGroup int)

func (*EmailMessage) GetContent

func (this *EmailMessage) GetContent() string

type EmailMessageTypeVisitor

type EmailMessageTypeVisitor interface {
	// contains filtered or unexported methods
}

type EmailRecipient

type EmailRecipient struct {
	FullName     string
	EmailAddress string
}

func CreateEmailRecipient

func CreateEmailRecipient(fullName, emailAddress string) *EmailRecipient

func (*EmailRecipient) AsArray

func (this *EmailRecipient) AsArray() []*EmailRecipient

type IEmailMessageType

type IEmailMessageType interface {
	Accept(EmailMessageTypeVisitor)
}
var HtmlEmailMessageType IEmailMessageType = &htmlEmailMessageType{}
var TextEmailMessageType IEmailMessageType = &textEmailMessageType{}

type QueuedEmail

type QueuedEmail struct {
	Id                 int64
	FromEmail          string         `orm:"type(text)"` //Only the email address not the person name
	RecipientEmailsCsv string         `orm:"type(text)"` //Only their email addresses not the person names
	Content            string         `orm:"type(text)"`
	SendDueTime        time.Time      `orm:"type(datetime)"`
	SuccessfullySentOn time.Time      `orm:"null;type(datetime)"` //Default null
	SendError          sql.NullString `orm:"null"`                //When an error occurs in sending
	DebugInfo          string
}

func CreateQueuedEmail_FromEmailMessage

func CreateQueuedEmail_FromEmailMessage(emailMessage *EmailMessage) *QueuedEmail

func (*QueuedEmail) Count_UnsentAndDue

func (this *QueuedEmail) Count_UnsentAndDue(ormContext *OrmContext) int64

func (*QueuedEmail) GetSplittedRecipientEmailAddresses

func (this *QueuedEmail) GetSplittedRecipientEmailAddresses() []string

func (*QueuedEmail) Insert

func (this *QueuedEmail) Insert(ormContext *OrmContext)

func (*QueuedEmail) List_UnsentAndDue

func (this *QueuedEmail) List_UnsentAndDue(ormContext *OrmContext, loadRelatedSettings *RelatedFieldsToLoad, orderByFields ...string) []*QueuedEmail

func (*QueuedEmail) ReadUsingID

func (this *QueuedEmail) ReadUsingID(ormContext *OrmContext, id int64, loadRelatedSettings *RelatedFieldsToLoad)

func (*QueuedEmail) TableEngine

func (u *QueuedEmail) TableEngine() string

func (*QueuedEmail) TableIndex

func (u *QueuedEmail) TableIndex() [][]string

func (*QueuedEmail) TableName

func (u *QueuedEmail) TableName() string

func (*QueuedEmail) TableUnique

func (u *QueuedEmail) TableUnique() [][]string

func (*QueuedEmail) Update_MarkAsSuccessfullySent

func (this *QueuedEmail) Update_MarkAsSuccessfullySent(ormContext *OrmContext) []ChangedField

func (*QueuedEmail) Update_SetSendError

func (this *QueuedEmail) Update_SetSendError(ormContext *OrmContext, errorString string) []ChangedField

Jump to

Keyboard shortcuts

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