Documentation ¶
Index ¶
- type BulkEmailMessageResult
- type Email
- func (e *Email) GenerateSendEmailInput() (*ses.SendEmailInput, error)
- func (e *Email) GenerateSendRawEmailInput(attachmentFileName string, attachmentContentType string, attachmentData []byte) (*ses.SendRawEmailInput, error)
- func (e *Email) Initial(from string, to string, subject string, bodyText string, bodyHtml ...string) *Email
- func (e *Email) SetBCC(bccAddress ...string) *Email
- func (e *Email) SetCC(ccAddress ...string) *Email
- func (e *Email) SetReplyTo(replyToAddress ...string) *Email
- func (e *Email) SetTo(toAddress ...string) *Email
- type EmailTarget
- type SES
- func (s *SES) Connect(parentSegment ...*xray.XRayParentSegment) (err error)
- func (s *SES) CreateCustomVerificationEmailTemplate(templateName string, templateSubject string, templateContent string, ...) (err error)
- func (s *SES) CreateTemplate(templateName string, subjectPart string, textPart string, htmlPart string, ...) (err error)
- func (s *SES) DeleteCustomVerificationEmailTemplate(templateName string, timeOutDuration ...time.Duration) (err error)
- func (s *SES) DeleteTemplate(templateName string, timeOutDuration ...time.Duration) (err error)
- func (s *SES) Disconnect()
- func (s *SES) GetSendQuota(timeOutDuration ...time.Duration) (sq *SendQuota, err error)
- func (s *SES) SendBulkTemplateEmail(senderEmail string, returnPath string, replyTo string, templateName string, ...) (resultList []*BulkEmailMessageResult, failedCount int, err error)
- func (s *SES) SendCustomVerificationEmail(templateName string, toEmailAddress string, timeOutDuration ...time.Duration) (messageId string, err error)
- func (s *SES) SendEmail(email *Email, timeOutDuration ...time.Duration) (messageId string, err error)
- func (s *SES) SendRawEmail(email *Email, attachmentFileName string, attachmentContentType string, ...) (messageId string, err error)
- func (s *SES) SendTemplateEmail(senderEmail string, returnPath string, replyTo string, templateName string, ...) (messageId string, err error)
- func (s *SES) UpdateCustomVerificationEmailTemplate(templateName string, templateSubject string, templateContent string, ...) (err error)
- func (s *SES) UpdateParentSegment(parentSegment *xray.XRayParentSegment)
- func (s *SES) UpdateTemplate(templateName string, subjectPart string, textPart string, htmlPart string, ...) (err error)
- type SendQuota
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BulkEmailMessageResult ¶
BulkEmailMessageResult contains result of a bulk email
type Email ¶
type Email struct { // required From string // at least one element is required To []string // optional CC []string // optional BCC []string // required Subject string // either BodyHtml or BodyText is required BodyHtml string BodyText string // additional config info ReturnPath string ReplyTo []string // defaults to UTF-8 if left blank Charset string }
Email struct encapsulates the email message definition to send via AWS SES
func (*Email) GenerateSendEmailInput ¶
func (e *Email) GenerateSendEmailInput() (*ses.SendEmailInput, error)
GenerateSendEmailInput will create the SendEmailInput object from the struct fields
func (*Email) GenerateSendRawEmailInput ¶ added in v1.0.9
func (e *Email) GenerateSendRawEmailInput(attachmentFileName string, attachmentContentType string, attachmentData []byte) (*ses.SendRawEmailInput, error)
GenerateSendRawEmailInput will create the SendRawEmailInput object from the struct fields
attachmentContentType = See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
func (*Email) Initial ¶
func (e *Email) Initial(from string, to string, subject string, bodyText string, bodyHtml ...string) *Email
Initial sets new email message
parameters:
from = email sender from address to = email sender to address subject = email subject text bodyText = email body content in text (both bodyText and bodyHtml may be set at the same time) bodyHtml = email body content in html (both bodyText and bodyHtml may be set at the same time)
func (*Email) SetReplyTo ¶
SetReplyTo adds 'Reply-To' addresses to email
type EmailTarget ¶
type EmailTarget struct { // at least one element is required To []string // optional CC []string // optional BCC []string // required - template data in json TemplateDataJson string }
EmailTarget defines a single email target contact for use with SendTemplateEmail or SendBulkTemplateEmail methods
func (*EmailTarget) Initial ¶
func (t *EmailTarget) Initial(templateDataJson string, toAddress ...string) *EmailTarget
Initial will set template data in json, and list of toAddresses variadic
func (*EmailTarget) SetBCC ¶
func (t *EmailTarget) SetBCC(bccAddress ...string) *EmailTarget
SetBCC will set list of bccAddress variadic to EmailTarget
func (*EmailTarget) SetCC ¶
func (t *EmailTarget) SetCC(ccAddress ...string) *EmailTarget
SetCC will set list of ccAddress variadic to EmailTarget
type SES ¶
type SES struct { // define the AWS region that SES is located at AwsRegion awsregion.AWSRegion // custom http2 client options HttpOptions *awshttp2.HttpClientSettings // define configuration set to use if any ConfigurationSetName string // contains filtered or unexported fields }
SES struct encapsulates the AWS SES access functionality
func (*SES) Connect ¶
func (s *SES) Connect(parentSegment ...*xray.XRayParentSegment) (err error)
Connect will establish a connection to the SES service
func (*SES) CreateCustomVerificationEmailTemplate ¶
func (s *SES) CreateCustomVerificationEmailTemplate(templateName string, templateSubject string, templateContent string, fromEmailAddress string, successRedirectionURL string, failureRedirectionURL string, timeOutDuration ...time.Duration) (err error)
CreateCustomVerificationEmailTemplate will create a template for use with custom verification of email address
parameters:
- templateName = the name of the template, must be unique
- templateSubject = the subject of the verification email (note that there is no tag name value replacement here)
- templateContent = the body of the email, can be html or text (note that there is no tag name value replacement here)
- fromEmailAddress = the email address that the verification email is sent from (must be email address)
- successRedirectionURL = the url that users are sent to if their email addresses are successfully verified
- failureRedirectionURL = the url that users are sent to if their email addresses are not successfully verified
- timeOutDuration = optional time out value to use in context
func (*SES) CreateTemplate ¶
func (s *SES) CreateTemplate(templateName string, subjectPart string, textPart string, htmlPart string, timeOutDuration ...time.Duration) (err error)
CreateTemplate will create an email template for use with SendTemplateEmail and SendBulkTemplateEmail methods
parameters:
- templateName = name of the template, must be unique
- subjectPart = subject text with tag name value replacements
- textPart = body text with tag name value replacements
- htmlPart = body html with tag name value replacements
- timeOutDuration = optional time out value to use in context
template tokens:
- subjectPart, textPart, htmlPart = may contain Tag Names for personalization
- Tag Name = using {{tagName}} within the string defined above in #1
- example: a) Greetings, {{name}} b) <h1>hello {{name}}, how are you</h1><p>Today is {{dayOfWeek}}</p> c) <html><head></head><body><h1>hello {{name}}, how are you</h1><p>Today is {{dayOfWeek}}</p></body></html>
- when sending template mail, the Tag Name values are replaced via key-Value pairs within TemplateData in SendTemplateEmail and SendBulkTemplateEmail methods: a) { "name":"Harry", "dayOfWeek":"Monday" }
func (*SES) DeleteCustomVerificationEmailTemplate ¶
func (s *SES) DeleteCustomVerificationEmailTemplate(templateName string, timeOutDuration ...time.Duration) (err error)
DeleteCustomVerificationEmailTemplate will delete a custom verification email template
parameters:
- templateName = name of the template to delete
- timeOutDuration = optional time out value to use in context
func (*SES) DeleteTemplate ¶
DeleteTemplate will delete an existing email template
parameters:
- templateName = name of the template to delete
- timeOutDuration = optional time out value to use in context
func (*SES) Disconnect ¶
func (s *SES) Disconnect()
Disconnect will disjoin from aws session by clearing it
func (*SES) GetSendQuota ¶
GetSendQuota will get the ses send quota
func (*SES) SendBulkTemplateEmail ¶
func (s *SES) SendBulkTemplateEmail(senderEmail string, returnPath string, replyTo string, templateName string, defaultTemplateDataJson string, emailTargetList []*EmailTarget, timeOutDuration ...time.Duration) (resultList []*BulkEmailMessageResult, failedCount int, err error)
SendBulkTemplateEmail will send out bulk email via ses using template
parameters:
- senderEmail = sender's email address
- returnPath = optional, email return path address
- replyTo = optional, email reply to address
- templateName = the name of the template to use for sending out template emails
- defaultTemplateDataJson = the default template data key value pairs in json, to be used if emailTarget did not define a template data json
- emailTargetList = slice of pointer to email target object defining where the email is sent to, along with template data key value pairs in json
- timeOutDuration = optional, time out value to use in context
template tokens:
- subjectPart, textPart, htmlPart = may contain Tag Names for personalization
- Tag Name = using {{tagName}} within the string defined above in #1
- example: a) Greetings, {{name}} b) <h1>hello {{name}}, how are you</h1><p>Today is {{dayOfWeek}}</p> c) <html><head></head><body><h1>hello {{name}}, how are you</h1><p>Today is {{dayOfWeek}}</p></body></html>
- when sending template mail, the Tag Name values are replaced via key-Value pairs within TemplateData in SendTemplateEmail and SendBulkTemplateEmail methods: a) { "name":"Harry", "dayOfWeek":"Monday" }
notes:
a) Template = name of template to apply to the email b) DefaultTemplateData = json string holding key-value pair of Tag Name and Tag Value (see below about template tokens) acting as a catch all default in case destination level replacement template data is not set c) Source = email address of sender d) ReturnPath = return email address (usually same as source) e) ReplyToAddresses = list of email addresses for email reply to f) Destinations = one or more Destinations, each defining target, and replacement template data for that specific destination g) ConfigurationSetName = if ses has a set defined, and need to be used herein
limits:
- bulk is limited to 50 destinations per single call (subject to aws ses limits on account)
func (*SES) SendCustomVerificationEmail ¶
func (s *SES) SendCustomVerificationEmail(templateName string, toEmailAddress string, timeOutDuration ...time.Duration) (messageId string, err error)
SendCustomVerificationEmail will send out a custom verification email to recipient
parameters:
- templateName = name of the template to use for the verification email
- toEmailAddress = the email address to send verification to
- timeOutDuration = optional time out value to use in context
func (*SES) SendEmail ¶
func (s *SES) SendEmail(email *Email, timeOutDuration ...time.Duration) (messageId string, err error)
SendEmail will send an email message out via SES
func (*SES) SendRawEmail ¶ added in v1.0.9
func (s *SES) SendRawEmail(email *Email, attachmentFileName string, attachmentContentType string, timeOutDuration ...time.Duration) (messageId string, err error)
SendRawEmail will send an raw email message out via SES, supporting attachments
attachmentContentType = See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
func (*SES) SendTemplateEmail ¶
func (s *SES) SendTemplateEmail(senderEmail string, returnPath string, replyTo string, templateName string, emailTarget *EmailTarget, timeOutDuration ...time.Duration) (messageId string, err error)
SendTemplateEmail will send out email via ses using template
parameters:
- senderEmail = sender's email address
- returnPath = optional, email return path address
- replyTo = optional, email reply to address
- templateName = the name of the template to use for sending out template emails
- emailTarget = pointer to email target object defining where the email is sent to, along with template data key value pairs in json
- timeOutDuration = optional, time out value to use in context
template tokens:
- subjectPart, textPart, htmlPart = may contain Tag Names for personalization
- Tag Name = using {{tagName}} within the string defined above in #1
- example: a) Greetings, {{name}} b) <h1>hello {{name}}, how are you</h1><p>Today is {{dayOfWeek}}</p> c) <html><head></head><body><h1>hello {{name}}, how are you</h1><p>Today is {{dayOfWeek}}</p></body></html>
- when sending template mail, the Tag Name values are replaced via key-Value pairs within TemplateData in SendTemplateEmail and SendBulkTemplateEmail methods: a) { "name":"Harry", "dayOfWeek":"Monday" }
notes:
a) Template = name of template to apply to the email b) TemplateData = json string holding key-value pair of Tag Name and Tag Value (see below about template tokens) c) Source = email address of sender d) ReturnPath = return email address (usually same as source) e) ReplyToAddresses = list of email addresses for email reply to f) Destination = email send to destination g) ConfigurationSetName = if ses has a set defined, and need to be used herein
func (*SES) UpdateCustomVerificationEmailTemplate ¶
func (s *SES) UpdateCustomVerificationEmailTemplate(templateName string, templateSubject string, templateContent string, fromEmailAddress string, successRedirectionURL string, failureRedirectionURL string, timeOutDuration ...time.Duration) (err error)
UpdateCustomVerificationEmailTemplate will update a template for use with custom verification of email address
parameters:
- templateName = the name of the template, must be unique
- templateSubject = the subject of the verification email (note that there is no tag name value replacement here)
- templateContent = the body of the email, can be html or text (note that there is no tag name value replacement here)
- fromEmailAddress = the email address that the verification email is sent from (must be email address)
- successRedirectionURL = the url that users are sent to if their email addresses are successfully verified
- failureRedirectionURL = the url that users are sent to if their email addresses are not successfully verified
- timeOutDuration = optional time out value to use in context
func (*SES) UpdateParentSegment ¶ added in v1.1.4
func (s *SES) UpdateParentSegment(parentSegment *xray.XRayParentSegment)
UpdateParentSegment updates this struct's xray parent segment, if no parent segment, set nil
func (*SES) UpdateTemplate ¶
func (s *SES) UpdateTemplate(templateName string, subjectPart string, textPart string, htmlPart string, timeOutDuration ...time.Duration) (err error)
UpdateTemplate will update an existing email template for use with SendTemplateEmail and SendBulkTemplateEmail methods
parameters:
- templateName = name of the template, must be unique
- subjectPart = subject text with tag name value replacements
- textPart = body text with tag name value replacements
- htmlPart = body html with tag name value replacements
- timeOutDuration = optional time out value to use in context
template tokens:
- subjectPart, textPart, htmlPart = may contain Tag Names for personalization
- Tag Name = using {{tagName}} within the string defined above in #1
- example: a) Greetings, {{name}} b) <h1>hello {{name}}, how are you</h1><p>Today is {{dayOfWeek}}</p> c) <html><head></head><body><h1>hello {{name}}, how are you</h1><p>Today is {{dayOfWeek}}</p></body></html>
- when sending template mail, the Tag Name values are replaced via key-Value pairs within TemplateData in SendTemplateEmail and SendBulkTemplateEmail methods: a) { "name":"Harry", "dayOfWeek":"Monday" }