Documentation ¶
Index ¶
- Variables
- func InjectVars(t MailTemplate, vars map[string]string) (string, error)
- func SendEmail(ctx context.Context, subject string, to *mail.Email, plainTextContent string, ...) (*rest.Response, error)
- func SendResponse(w http.ResponseWriter, code int)
- type MailRequest
- type MailResponse
- type MailSender
- type MailTemplate
Constants ¶
This section is empty.
Variables ¶
View Source
var (
MailSenderFunc func(string) MailSender = defaultSendGridClient
)
Functions ¶
func InjectVars ¶
func InjectVars(t MailTemplate, vars map[string]string) (string, error)
InjectVars takes a MailTemplate and a key-value map that is used to map template variables in the mail body to resolved values from the input map. This function expects the vars in the template to be formatted as "{var}", where `var` is the key, and it is surrounded by curly braces. This makes it so that the request body can contain a simple key-value pair, e.g.:
{ "var": "foo" }
func SendResponse ¶
func SendResponse(w http.ResponseWriter, code int)
SendResponse writes a response back to the HTTP client
Types ¶
type MailRequest ¶
type MailResponse ¶
type MailResponse struct {
Success bool `json:"success"`
}
type MailSender ¶
type MailTemplate ¶
Click to show internal directories.
Click to hide internal directories.