Documentation
¶
Index ¶
- Constants
- Variables
- func SendAsync(e *Email) chan *SendAsyncResult
- type Email
- type EmailBinaryData
- type EmailCustomHeader
- type EndpointError
- type IncorrectAPIKeyFormatError
- type InvalidJSONError
- type MissingAPIKeyError
- type MissingRequiredFieldError
- type RequestError
- type SendAsyncResult
- type Smtp2goApiResult
- type Smtp2goApiResult_Data
- type Smtp2goApiResult_FieldFailure
Constants ¶
const APIHeader string = "X-Smtp2go-Api"
const APIKeyEnv string = "SMTP2GO_API_KEY"
const APIKeyHeader string = "X-Smtp2go-Api-Key"
const APIRootEnv string = "SMTP2GO_API_ROOT"
const APIVersionHeader string = "X-Smtp2go-Api-Version"
Variables ¶
var APIKeyRegexp *regexp.Regexp = regexp.MustCompile("^api-[a-zA-Z0-9]{32}$")
Functions ¶
func SendAsync ¶
func SendAsync(e *Email) chan *SendAsyncResult
SendAsync asynchronous send function
Types ¶
type Email ¶
type Email struct {
From string `json:"sender"`
To []string `json:"to"`
Cc []string `json:"cc"`
Bcc []string `json:"bcc"`
Subject string `json:"subject"`
TextBody string `json:"text_body"`
HtmlBody string `json:"html_body"`
TemplateID string `json:"template_id"`
TemplateData interface{} `json:"template_data"`
CustomHeaders []*EmailCustomHeader `json:"custom_headers"`
Attachments []*EmailBinaryData `json:"attachments"`
Inlines []*EmailBinaryData `json:"inlines"`
}
Email holds the data used to send the email
type EmailBinaryData ¶ added in v1.0.4
type EmailCustomHeader ¶ added in v1.0.4
type EndpointError ¶
type EndpointError struct {
// contains filtered or unexported fields
}
EndpointError error during endpoint call
func (EndpointError) Error ¶
func (f EndpointError) Error() string
Error implementation of Error on EndpointError
type IncorrectAPIKeyFormatError ¶
type IncorrectAPIKeyFormatError struct {
// contains filtered or unexported fields
}
IncorrectAPIKeyFormatError error for bad api key
func (IncorrectAPIKeyFormatError) Error ¶
func (f IncorrectAPIKeyFormatError) Error() string
Error implementation of Error on IncorrectAPIKeyFormatError
type InvalidJSONError ¶
type InvalidJSONError struct {
// contains filtered or unexported fields
}
InvalidJSONError error due to bad json
func (InvalidJSONError) Error ¶
func (f InvalidJSONError) Error() string
Error implementation of Error on InvalidJSONError
type MissingAPIKeyError ¶
type MissingAPIKeyError string
MissingAPIKeyError error for missing api key
func (MissingAPIKeyError) Error ¶
func (f MissingAPIKeyError) Error() string
Error implementation of Error on MissingAPIKeyError
type MissingRequiredFieldError ¶
type MissingRequiredFieldError struct {
// contains filtered or unexported fields
}
MissingRequiredFieldError error fro missing field
func (MissingRequiredFieldError) Error ¶
func (f MissingRequiredFieldError) Error() string
Error implementation of Error on MissingRequiredFieldError
type RequestError ¶
type RequestError struct {
// contains filtered or unexported fields
}
RequestError error during request
func (RequestError) Error ¶
func (f RequestError) Error() string
Error implementation of Error on RequestError
type SendAsyncResult ¶
type SendAsyncResult struct {
Error error
Result *Smtp2goApiResult
}
SendAsyncResult result struct from async send call
type Smtp2goApiResult ¶
type Smtp2goApiResult struct {
RequestId string `json:"request_id"`
Data Smtp2goApiResult_Data `json:"data"`
}
Smtp2goApiResult response payload from the API
type Smtp2goApiResult_Data ¶
type Smtp2goApiResult_Data struct {
Error string `json:"error"`
ErrorCode string `json:"error_code"`
FieldValidationErrors Smtp2goApiResult_FieldFailure `json:"field_validation_errors"`
}
Smtp2goApiResult_Data struct that holds the response data from the API
type Smtp2goApiResult_FieldFailure ¶
type Smtp2goApiResult_FieldFailure struct {
FieldName string `json:"fieldname"`
Message string `json:"message"`
}
Smtp2goApiResult_FieldFailure if fields failed on the api side this will hold the information