Documentation ¶
Index ¶
- type AccountResult
- type BatchOption
- type BatchResult
- type BatchSimulate
- type BatchState
- type BatchStatusOption
- type BatchStatusResult
- type Emailable
- func (e Emailable) GetAccountInfo() (*AccountResult, error)
- func (e Emailable) GetApiKey() string
- func (e Emailable) GetBatchStatus(id string) (*BatchStatusResult, error)
- func (e Emailable) GetBatchStatusWithOption(id string, o BatchStatusOption) (*BatchStatusResult, error)
- func (e *Emailable) SetApiKey(key string)
- func (e Emailable) VerifyBatch(emails []string) (*BatchResult, error)
- func (e Emailable) VerifyBatchWithOption(emails []string, o BatchOption) (*BatchResult, error)
- func (e Emailable) VerifyEmail(email string) (*VerifyEmailResult, error)
- func (e Emailable) VerifyEmailWithOption(email string, o UniqueOption) (*VerifyEmailResult, error)
- type EmailableError
- type ReasonCounts
- type ResponseField
- type StatusSimulate
- type TotalCounts
- type UniqueOption
- type VerifyEmailResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountResult ¶
type BatchOption ¶
type BatchOption struct { // A URL that will receive the batch results via HTTP POST. Url *url.URL // A comma separated list of fields to include in the response. // If nothing is specified, all fields will be returned. // Valid fields are accept_all, did_you_mean, disposable, domain, email, first_name, free, full_name, gender, last_name, mx_record, reason, role, score, smtp_provider, state, tag, and user. ResponseFields []ResponseField // Defaults to true. // Retries increase accuracy by automatically retrying verification when our system receives certain responses from mail servers. // To speed up verification, you can disable this by setting retries to false; however, doing so may increase the number of unknown responses. Retries bool // A boolean value indicating whether to include partial results when a batch is still verifying. // This option is only available for batches with up to 1,000 emails. Defaults to false. Partial bool // contains filtered or unexported fields }
https://emailable.com/docs/api/#verify-a-batch-of-emails
func (*BatchOption) AddSimulate ¶
func (o *BatchOption) AddSimulate(s BatchSimulate)
func (*BatchOption) RemoveSimulate ¶
func (o *BatchOption) RemoveSimulate()
type BatchResult ¶
type BatchSimulate ¶
type BatchSimulate string
const ( GenericError BatchSimulate = "generic_error" InsufficientCreditsError BatchSimulate = "insufficient_credits_error" PaymentError BatchSimulate = "payment_error" CardError BatchSimulate = "card_error" )
type BatchState ¶
type BatchState uint
const ( Importing BatchState = iota Verifying Paused )
func (BatchState) String ¶
func (s BatchState) String() string
type BatchStatusOption ¶
type BatchStatusOption struct { // A boolean value indicating whether to include partial results when a batch is still verifying. //This option is only available for batches with up to 1,000 emails. Defaults to false. Partial bool // contains filtered or unexported fields }
func (*BatchStatusOption) AddSimulate ¶
func (o *BatchStatusOption) AddSimulate(s StatusSimulate)
func (*BatchStatusOption) RemoveSimulate ¶
func (o *BatchStatusOption) RemoveSimulate()
type BatchStatusResult ¶
type BatchStatusResult struct { // A message about your batch. Message string `json:"message"` // The number of emails that have been verified in the batch. Processed uint64 `json:"processed,omitempty"` // The total number of emails in your batch. Total uint64 `json:"total,omitempty"` // An array containing responses for each email in the batch. // This field will only be returned for batches up to 1,000 emails. // (See [single email verification]: https://emailable.com/docs/api/#verify-an-email for more information on the response fields.) Emails []VerifyEmailResult `json:"emails,omitempty"` DownloadFile string `json:"download_file,omitempty"` Id string `json:"id,omitempty"` ReasonCounts ReasonCounts `json:"reason_counts,omitempty"` TotalCounts TotalCounts `json:"total_counts,omitempty"` }
type Emailable ¶
type Emailable struct {
// contains filtered or unexported fields
}
func NewEmailable ¶
func (Emailable) GetAccountInfo ¶
func (e Emailable) GetAccountInfo() (*AccountResult, error)
Get general account information like the email of the account owner and available credits.
func (Emailable) GetBatchStatus ¶
func (e Emailable) GetBatchStatus(id string) (*BatchStatusResult, error)
GET requests to the batch endpoint will get the current status of the batch verification job specified in the id parameter. When a credit card transaction is necessary to obtain enough credits to verify a batch, billing related messages will be returned if there is an error. These will be sent with a 402 response code. When a test key is used, a random sample response will be returned for each email in the batch. Additionally, it is possible to simulate certain API responses when using a test key by utilizing the simulate parameter.
func (Emailable) GetBatchStatusWithOption ¶
func (e Emailable) GetBatchStatusWithOption(id string, o BatchStatusOption) (*BatchStatusResult, error)
func (Emailable) VerifyBatch ¶
func (e Emailable) VerifyBatch(emails []string) (*BatchResult, error)
Verify a batch of emails. The emails should be sent as a parameter emails and should be separated by commas. Up to 50,000 emails can be sent per batch. For enterprise accounts, up to 1,000,000 emails can be sent per batch.
func (Emailable) VerifyBatchWithOption ¶
func (e Emailable) VerifyBatchWithOption(emails []string, o BatchOption) (*BatchResult, error)
Verify a batch of emails. The emails should be sent as a parameter emails and should be separated by commas. Up to 50,000 emails can be sent per batch. For enterprise accounts, up to 1,000,000 emails can be sent per batch.
func (Emailable) VerifyEmail ¶
func (e Emailable) VerifyEmail(email string) (*VerifyEmailResult, error)
Verify a single email. If a verification request takes longer than the timeout, you may retry this request for up to 5 minutes. After 5 minutes, further requests will count against your usage. The verification result will be returned when it is available.
func (Emailable) VerifyEmailWithOption ¶
func (e Emailable) VerifyEmailWithOption(email string, o UniqueOption) (*VerifyEmailResult, error)
Verify a single email. If a verification request takes longer than the timeout, you may retry this request for up to 5 minutes. After 5 minutes, further requests will count against your usage. The verification result will be returned when it is available. When a test key is used, a random sample response will be returned.
type EmailableError ¶
type EmailableError error
var ( // Error based on status code, Url for more information https://emailable.com/docs/api/#status-codes TimeoutError EmailableError = errors.New("The specified resource does not exist.") BadRequest EmailableError = errors.New("Your request is structured incorrectly.") ApiKeyMissing EmailableError = errors.New("Your request is structured incorrectly.") LowCredit EmailableError = errors.New("You don't have enough credits to complete this request.") InvalidApiKey EmailableError = errors.New("Your API key is invalid.") NotFound EmailableError = errors.New("The specified resource does not exist.") UnknownStatusCode EmailableError = errors.New("unknown status code") TooManyRequest EmailableError = errors.New("You're requesting an endpoint too often.") InternalServerError EmailableError = errors.New("A server error occurred. Please try again later, or contact support if you're having trouble.") // Emailbased on usage MoreEmail EmailableError = errors.New("Please send more than one email.") )
type ReasonCounts ¶
type ReasonCounts struct { AcceptedEmail uint64 `json:"accepted_email"` InvalidDomain uint64 `json:"invalid_domain"` InvalidEmail uint64 `json:"invalid_email"` InvalidSmtp uint64 `json:"invalid_smtp"` LowDeliverability uint64 `json:"low_deliverability"` LowQuality uint64 `json:"low_quality"` NoConnect uint64 `json:"no_connect"` RejectedEmail uint64 `json:"rejected_email"` Timeout uint64 `json:"timeout"` UnexpectedError uint64 `json:"unexpected_error"` }
A hash with one key per possible reason attribute. The values are integers representing the number of emails with that reason.
type ResponseField ¶
type ResponseField string
const ( AcceptAll ResponseField = "accept_all" DidYouMean ResponseField = "did_you_mean" Disposable ResponseField = "disposable" Domain ResponseField = "domain" Email ResponseField = "email" FirstName ResponseField = "first_name" Free ResponseField = "free" FullName ResponseField = "full_name" Gender ResponseField = "gender" LastName ResponseField = "last_name" MxRecord ResponseField = "mx_record" Reason ResponseField = "reason" Role ResponseField = "role" Score ResponseField = "score" SmtpProvider ResponseField = "smtp_provider" State ResponseField = "state" Tag ResponseField = "tag" User ResponseField = "user" )
type StatusSimulate ¶
type StatusSimulate string
const ( StatusGenericError StatusSimulate = "generic_error" StatusImporting StatusSimulate = "importing" StatusVerifying StatusSimulate = "verifying" StatusPaused StatusSimulate = "paused" )
type TotalCounts ¶
type TotalCounts struct { Deliverable uint64 `json:"deliverable"` Processed uint64 `json:"processed"` Risky uint64 `json:"risky"` Total uint64 `json:"total"` Undeliverable uint64 `json:"undeliverable"` Unknown uint64 `json:"unknown"` }
A hash with one key per possible state attribute. The values are integers representing the number of emails with that state. In addition to the state keys, total_counts also contains keys processed and total, with values indicating the number of emails in the batch.
type UniqueOption ¶
type VerifyEmailResult ¶
type VerifyEmailResult struct { // Whether the mail server used to verify indicates that all addresses are deliverable regardless of whether or not the email is valid. AcceptAll bool `json:"accept_all,omitempty"` // A suggested correction for a common misspelling. DidYouMean string `json:"did_you_mean,omitempty"` // Whether this email is hosted on a disposable or temporary email service. Disposable bool `json:"disposable"` // The domain of the email. (e.g. The domain for john.smith@gmail.com would be gmail.com) Domain string `json:"domain"` // The length of time (in seconds) spent verifying this email. Duration float64 `json:"duration"` // The email that was verified. Email string `json:"email"` // The possible first name of the user. FirstName string `json:"first_name,omitempty"` // Whether the email is hosted by a free email provider. Free bool `json:"free"` // The possible full name of the user. FullName string `json:"full_name,omitempty"` // The possible gender of the user. Gender string `json:"gender,omitempty"` // The possible last name of the user. LastName string `json:"last_name,omitempty"` // The mailbox is currently full and emails may not be delivered. MailboxFull bool `json:"mailbox_full"` // The address of the mail server used to verify the email. MxRecord string `json:"mx_record,omitempty"` // An address that indicates it should not be replied to. NoReply bool `json:"no_reply"` // The reason for the associated Reason string `json:"reason,omitempty"` // Whether the email is considered a role address. (e.g. support, info, etc.) Role bool `json:"role"` // The score of the verified email. Score int `json:"score"` // The SMTP provider of the verified email's domain. SmtpProvider string `json:"smtp_provider,omitempty"` // The state of the verified email. (e.g. deliverable, undeliverable, risky, unknown) State string `json:"state"` // The tag part of the verified email. (e.g. The tag for john.smith+example@gmail.com would be example) Tag string `json:"tag,omitempty"` // The user part of the verified email. (e.g. The user for john.smith@gmail.com would be john.smith) User string `json:"user,omitempty"` }