Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Domains = map[string]struct{}{
"1secmail.com": {},
"1secmail.org": {},
"1secmail.net": {},
"bheps.com": {},
"dcctb.com": {},
"kzccv.com": {},
"qiott.com": {},
"wuuvo.com": {},
}
Functions ¶
This section is empty.
Types ¶
type API ¶ added in v1.0.0
type API struct {
// contains filtered or unexported fields
}
API manages communication with the 1secmail's APIs that do not belong to a specific mailbox.
func NewAPI ¶ added in v1.0.0
func NewAPI(httpClient HTTPClient) API
NewAPI returns a new API. If nil httpClient is provided, a new http.Client will be created.
func (API) RandomAddresses ¶ added in v1.0.0
func (API) UpdateDomains ¶ added in v1.0.0
UpdateDomains updates the list of domains that 1secmail supports. This is useful if the list of domains have changed since this library was last updated.
type Attachment ¶
type Attachment struct {
Filename string `json:"filename"`
ContentType string `json:"contentType"`
Size int `json:"size"`
}
Attachment represents an attachment in a 1secmail mail.
type HTTPClient ¶
HTTPClient is an interface that makes an HTTP request.
type Mail ¶
type Mail struct {
ID int `json:"id"`
From string `json:"from"`
Subject string `json:"subject"`
Date string `json:"date"`
Attachments []Attachment `json:"attachments,omitempty"`
Body *string `json:"body,omitempty"`
TextBody *string `json:"textBody,omitempty"`
HTMLBody *string `json:"htmlBody,omitempty"`
}
Mail represents a mail in a 1secmail inbox.
type Mailbox ¶
Mailbox manages communication with the 1secmail's APIs that belong to a specific mailbox.
func NewMailbox ¶
func NewMailbox(login, domain string, httpClient HTTPClient) (Mailbox, error)
NewMailbox returns a new Mailbox. Use login and domain for the email handler that you intend to use. Login is the email username. If nil httpClient is provided, a new http.Client will be created.
func NewMailboxWithAddress ¶ added in v1.0.0
func NewMailboxWithAddress(address string, httpClient HTTPClient) (Mailbox, error)
NewMailboxWithAddress returns a new Mailbox. It accepts an email address that refers to a 1secmail mailbox. This is easier to use than NewMailbox if you already have an email address. If nil httpClient is provided, a new http.Client will be created.
func (Mailbox) CheckInbox ¶
CheckInbox checks the inbox of a mailbox, and returns a list of mails.