Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultConfig = make(Config)
DefaultConfig is the config used when using functions New, Add, and Parse. This helps keep boilerplate code to a minimum.
Functions ¶
Types ¶
type Attachment ¶
Attachment contains file data for an email attachment
type Config ¶
Config is a map of Forms used when parsing a submission to load the correct form settings and emails.
type Email ¶
type Email struct { // ID is used when looking up SMTP settings. // It is case-insensitive but will be matched as UPPERCASE. ex: SMTP_FORM-ID_HOST. ID string To string From string Cc []string Bcc []string ReplyTo string Subject string // Template is a go html template to be used when generating the email. Template string }
Email contains all the setting to send an email
type Form ¶
type Form struct { // ID is a case-insensitive string used to look up forms while parsing a submission. It will be matched to a submission's _form_name field. // If ID is not set, a case-insensitive version of Name will be used for matching instead. ID string // Name is a way to store a "Pretty" version of the form ID. Name string // Emails is a list of emails. Generally you want to use the AddEmail method instead of adding emails directly. Emails []Email // Redirect is used when with the default handlers to return 303 See Other and points the browser to the set value. Redirect string // When ReCAPTCHA is set to true the default handlers with verify the g-recaptcha-response field. ReCAPTCHA bool // contains filtered or unexported fields }
Form is for settings that should be set per submission but not per email. Such as redirects and ReCAPTCHA.
type Submission ¶
type Submission struct { // Form is the form this submission submitted as. Form *Form // Order is a list of the fields in the original order of submisson. // Maps in go are sorted alphabetically which causes readability issues in the generated emails. Note only first level elements are ordered. // The fields set using Form.Ignore will be removed from this list. Order []string // Values contains the submitted form data. Values map[string]interface{} // Attachments is a list of files to be attached to the email Attachments []Attachment }
Submission is the unmarshaled version on the form submission. It contains the submitted values and the form settings needed for sending emails.
func Parse ¶
func Parse(contentType, body string) (*Submission, error)
Parse creates a submission using the default config.
Click to show internal directories.
Click to hide internal directories.