Documentation ¶
Index ¶
- type Account
- type AccountUser
- type AccountUserResources
- type AccountUserSpecifier
- type AccountUsersService
- type AccountUsersServiceContract
- type AccountsService
- type AccountsServiceContract
- type Attachment
- type AttachmentsService
- type AttachmentsServiceContract
- type EmailAddress
- type EmailAttachment
- type ErrorResponse
- type Event
- type Events
- type Inbox
- type InboxesService
- func (s *InboxesService) Clean(accountID, inboxID int) (*Inbox, *Response, error)
- func (s *InboxesService) Create(accountID, inboxID int, name string) (*Inbox, *Response, error)
- func (s *InboxesService) Delete(accountID, inboxID int) (*Response, error)
- func (s *InboxesService) EnableEmail(accountID, inboxID int) (*Inbox, *Response, error)
- func (s *InboxesService) Get(accountID, inboxID int) (*Inbox, *Response, error)
- func (s *InboxesService) List(accountID int) ([]*Inbox, *Response, error)
- func (s *InboxesService) MarkAsRead(accountID, inboxID int) (*Inbox, *Response, error)
- func (s *InboxesService) ResetCredentials(accountID, inboxID int) (*Inbox, *Response, error)
- func (s *InboxesService) ResetEmail(accountID, inboxID int) (*Inbox, *Response, error)
- func (s *InboxesService) Update(accountID, inboxID int, updateReq *UpdateInboxRequest) (*Inbox, *Response, error)
- type InboxesServiceContract
- type ListAccountUsersParams
- type Message
- type MessageSMTPInfo
- type MessagesService
- func (s *MessagesService) AsEML(accountID, inboxID, messageID int) (string, *Response, error)
- func (s *MessagesService) AsHTML(accountID, inboxID, messageID int) (string, *Response, error)
- func (s *MessagesService) AsHTMLSource(accountID, inboxID, messageID int) (string, *Response, error)
- func (s *MessagesService) AsRaw(accountID, inboxID, messageID int) (string, *Response, error)
- func (s *MessagesService) AsText(accountID, inboxID, messageID int) (string, *Response, error)
- func (s *MessagesService) Delete(accountID, inboxID, messageID int) (*Response, error)
- func (s *MessagesService) Forward(accountID, inboxID, messageID int, email string) (*Response, error)
- func (s *MessagesService) Get(accountID, inboxID, messageID int) (*Message, *Response, error)
- func (s *MessagesService) List(accountID, inboxID int) ([]*Message, *Response, error)
- func (s *MessagesService) SpamReport(accountID, inboxID, messageID int) (*SpamReport, *Response, error)
- func (s *MessagesService) Update(accountID, inboxID, messageID int, updateReq *UpdateMessageRequest) (*Message, *Response, error)
- type MessagesServiceContract
- type PermissionRequest
- type Permissions
- type PermissionsService
- type PermissionsServiceContract
- type Project
- type ProjectsService
- func (s *ProjectsService) Create(accountID int, name string) (*Project, *Response, error)
- func (s *ProjectsService) Delete(accountID, projectID int) (*Response, error)
- func (s *ProjectsService) Get(accountID, projectID int) (*Project, *Response, error)
- func (s *ProjectsService) List(accountID int) ([]*Project, *Response, error)
- func (s *ProjectsService) Update(accountID, projectID int, name string) (*Project, *Response, error)
- type ProjectsServiceContract
- type Resource
- type Response
- type SendEmailRequest
- type SendEmailResponse
- type SendingClient
- type SpamReport
- type TestingClient
- type UpdateInboxRequest
- type UpdateMessageRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { ID int `json:"id"` Name string `json:"name"` AccessLevels []int `json:"access_levels"` }
Account represents a Mailtrap account schema.
type AccountUser ¶
type AccountUser struct { ID int `json:"id"` // specifier_type can return user, invite SpecifierType string `json:"specifier_type"` Resources []AccountUserResources `json:"resources"` Specifier AccountUserSpecifier `json:"specifier"` Permissions Permissions `json:"permissions"` }
AccountUsers represents a Mailtrap account users.
type AccountUserResources ¶
type AccountUserResources struct { // resource_type can return inbox, project, billing, account, mailsend_domain ResourceType string `json:"resource_type"` ResourceID int `json:"resource_id"` // access_level can return 1000 (account owner), 100 (admin), 10 (viewer). AccessLevel int `json:"access_level"` }
AccountUserResources represents a Mailtrap account users resources.
type AccountUserSpecifier ¶
type AccountUserSpecifier struct { ID int `json:"id"` Email string `json:"email"` Name string `json:"name"` }
AccountUserSpecifier represents a Mailtrap account users specifier.
type AccountUsersService ¶
type AccountUsersService struct {
// contains filtered or unexported fields
}
func (*AccountUsersService) Delete ¶
func (s *AccountUsersService) Delete(accountID, accountAccessID int) (*Response, error)
Delete removes user by their ID from the account. You need to be an account admin/owner for this endpoint to work.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/569947e980f71-remove-user-from-the-account
func (*AccountUsersService) List ¶
func (s *AccountUsersService) List( accountID int, params *ListAccountUsersParams, ) ([]*AccountUser, *Response, error)
List returns list of all account users.
You need to have account admin or owner permissions for this endpoint to work. If you specify project_ids, inbox_ids, the endpoint returns users filtered by these resources.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/be0de9a48df49-list-all-users-in-account
type AccountUsersServiceContract ¶
type AccountUsersServiceContract interface { List(accountID int, params *ListAccountUsersParams) ([]*AccountUser, *Response, error) Delete(accountID, accountAccessID int) (*Response, error) }
type AccountsService ¶
type AccountsService struct {
// contains filtered or unexported fields
}
func (*AccountsService) List ¶
func (s *AccountsService) List() ([]*Account, *Response, error)
List returns a list of Mailtrap accounts.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/4cfa4c61eae3c-get-all-accounts
type AccountsServiceContract ¶
type Attachment ¶
type Attachment struct { ID int `json:"id"` MessageID int `json:"message_id"` Filename string `json:"filename"` AttachmentType string `json:"attachment_type"` ContentType string `json:"content_type"` ContentID string `json:"content_id"` TransferEncoding string `json:"transfer_encoding"` AttachmentSize int `json:"attachment_size"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` AttachmentHumanSize string `json:"attachment_human_size"` DownloadPath string `json:"download_path"` }
Attachment represents a Mailtrap attachment schema.
type AttachmentsService ¶
type AttachmentsService struct {
// contains filtered or unexported fields
}
func (*AttachmentsService) Get ¶
func (s *AttachmentsService) Get( accountID, inboxID, messageID, attachmentID int, ) (*Attachment, *Response, error)
Get returns message single attachment by ID.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/e2e15ad4475a4-get-single-attachment
func (*AttachmentsService) List ¶
func (s *AttachmentsService) List( accountID, inboxID, messageID int, ) ([]*Attachment, *Response, error)
List returns message attachments by inboxID and messageID.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/bcb1ef001e32d-get-attachments
type AttachmentsServiceContract ¶
type AttachmentsServiceContract interface { List(accountID, inboxID, messageID int) ([]*Attachment, *Response, error) Get(accountID, inboxID, messageID, attachmentID int) (*Attachment, *Response, error) }
type EmailAddress ¶
EmailAddress represents an email address.
type EmailAttachment ¶
type EmailAttachment struct { // The Base64 encoded content of the attachment. // required Content string `json:"content"` // The MIME type of the content you are attaching (e.g., “text/plain” or “text/html”). AttachType string `json:"type"` // The attachment's filename. // required Filename string `json:"filename"` // The attachment's content-disposition, specifying how you would like the attachment to be displayed. // For example, “inline” results in the attached file are displayed automatically within the message // while “attachment” results in the attached file require some action to be taken before it is displayed, // such as opening or downloading the file. // // Allowed values: inline, attachment // Default: attachment Disposition string `json:"disposition"` // The attachment's content ID. // This is used when the disposition is set to “inline” and the attachment is an image, // allowing the file to be displayed within the body of your email. ContentID string `json:"content_id"` }
EmailAttachment represents an email attacments.
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response Message string `json:"message"` Errors []string `json:"errors"` }
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type Event ¶
type Event struct { Event string `json:"event"` Email string `json:"email"` Category string `json:"category"` MessageID string `json:"message_id"` CustomVariables map[string]string `json:"custom_variables"` EventID string `json:"event_id"` Timestamp int `json:"timestamp"` Response string `json:"response"` ResponseCode int `json:"response_code"` Reason string `json:"reason"` IP string `json:"ip"` UserAgent string `json:"user_agent"` URL string `json:"url"` }
Event represents an email event that user is subscribed to.
type Events ¶
type Events struct {
Events []Event `json:"events"`
}
Events is the wrapper around the Webhook event.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/b9cdfe3d25137-receive-events
type Inbox ¶
type Inbox struct { ID int `json:"id"` Name string `json:"name"` Username string `json:"username"` Password string `json:"password"` MaxSize int `json:"max_size"` Status string `json:"status"` EmailUsername string `json:"email_username"` EmailUsernameEnabled bool `json:"email_username_enabled"` SentMessagesCount int `json:"sent_messages_count"` ForwardedMessagesCount int `json:"forwarded_messages_count"` Used bool `json:"used"` ForwardFromEmailAddress string `json:"forward_from_email_address"` ProjectID int `json:"project_id"` Domain string `json:"domain"` POP3Domain string `json:"pop3_domain"` EmailDomain string `json:"email_domain"` EmailsCount int `json:"emails_count"` EmailsUnreadCount int `json:"emails_unread_count"` LastMessageSentAt string `json:"last_message_sent_at"` SMTPPorts []int `json:"smtp_ports"` POP3Ports []int `json:"pop3_ports"` MaxMessageSize int `json:"max_message_size"` Permissions Permissions `json:"permissions"` }
Inbox represents a Mailtrap inbox.
type InboxesService ¶
type InboxesService struct {
// contains filtered or unexported fields
}
func (*InboxesService) Clean ¶
func (s *InboxesService) Clean(accountID, inboxID int) (*Inbox, *Response, error)
Clean delete all messages (emails) from inbox.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/8a1e782a64fd0-clean-inbox
func (*InboxesService) Create ¶
Create creates an inbox in a project.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/86631e73937e2-create-an-inbox
func (*InboxesService) Delete ¶
func (s *InboxesService) Delete(accountID, inboxID int) (*Response, error)
Delete removes an inbox with all its emails.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/e624770632299-delete-project
func (*InboxesService) EnableEmail ¶
func (s *InboxesService) EnableEmail(accountID, inboxID int) (*Inbox, *Response, error)
EnableEmail enables email address.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/a4b31a4c40ae4-enable-email-address
func (*InboxesService) Get ¶
func (s *InboxesService) Get(accountID, inboxID int) (*Inbox, *Response, error)
Get returns attributes of the inbox.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/432a39abe34b3-get-inbox-attributes
func (*InboxesService) List ¶
func (s *InboxesService) List(accountID int) ([]*Inbox, *Response, error)
List returns the list of inboxes.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/49dd3b9d6806f-get-a-list-of-inboxes
func (*InboxesService) MarkAsRead ¶
func (s *InboxesService) MarkAsRead(accountID, inboxID int) (*Inbox, *Response, error)
MarkAsRead mark all messages in the inbox as read.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/8a38b0494dff1-mark-as-read
func (*InboxesService) ResetCredentials ¶
func (s *InboxesService) ResetCredentials(accountID, inboxID int) (*Inbox, *Response, error)
ResetCredentials resets SMTP credentials of the inbox.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/403fd0f1315e6-reset-credentials
func (*InboxesService) ResetEmail ¶
func (s *InboxesService) ResetEmail(accountID, inboxID int) (*Inbox, *Response, error)
ResetEmail reset email address
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/5ebb1ca46e3d0-reset-email-address
func (*InboxesService) Update ¶
func (s *InboxesService) Update(accountID, inboxID int, updateReq *UpdateInboxRequest) (*Inbox, *Response, error)
Update updates inbox name, inbox email username.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/768067eceee9d-update-an-inbox
type InboxesServiceContract ¶
type InboxesServiceContract interface { Create(accountID, inboxID int, name string) (*Inbox, *Response, error) Update(accountID, inboxID int, updRequest *UpdateInboxRequest) (*Inbox, *Response, error) List(accountID int) ([]*Inbox, *Response, error) Get(accountID, inboxID int) (*Inbox, *Response, error) Delete(accountID, inboxID int) (*Response, error) Clean(accountID, inboxID int) (*Inbox, *Response, error) MarkAsRead(accountID, inboxID int) (*Inbox, *Response, error) ResetCredentials(accountID, inboxID int) (*Inbox, *Response, error) EnableEmail(accountID, inboxID int) (*Inbox, *Response, error) ResetEmail(accountID, inboxID int) (*Inbox, *Response, error) }
type ListAccountUsersParams ¶
type ListAccountUsersParams struct { ProjectIDs *[]int `url:"project_ids,omitempty" json:"project_ids,omitempty"` InboxIDs *[]string `url:"inbox_ids,omitempty" json:"inbox_ids,omitempty"` }
ListAccountUsersParams represents the available List() query parameters.
type Message ¶
type Message struct { ID int `json:"id"` InboxID int `json:"inbox_id"` Subject string `json:"subject"` SentAt time.Time `json:"sent_at"` FromEmail string `json:"from_email"` FromName string `json:"from_name"` ToEmail string `json:"to_email"` ToName string `json:"to_name"` EmailSize int `json:"email_size"` IsRead bool `json:"is_read"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` HTMLBodySize int `json:"html_body_size"` TextBodySize int `json:"text_body_size"` HumanSize string `json:"human_size"` HTMLPath string `json:"html_path"` TxtPath string `json:"txt_path"` RawPath string `json:"raw_path"` DownloadPath string `json:"download_path"` HTMLSourcePath string `json:"html_source_path"` BlacklistsReportInfo bool `json:"blacklists_report_info"` SMTPInfo *MessageSMTPInfo `json:"smtp_information"` }
Message represents a Mailtrap message.
type MessageSMTPInfo ¶
type MessageSMTPInfo struct { Ok bool `json:"ok"` Data struct { MailFromAddr string `json:"mail_from_addr"` ClientIP string `json:"client_ip"` } `json:"data"` }
MessageSMTPInfo represents a Mailtrap message SMTP information.
type MessagesService ¶
type MessagesService struct {
// contains filtered or unexported fields
}
func (*MessagesService) AsEML ¶
func (s *MessagesService) AsEML(accountID, inboxID, messageID int) (string, *Response, error)
AsEML returns email message in .eml format.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/53cf46462fba5-update-message
func (*MessagesService) AsHTML ¶
func (s *MessagesService) AsHTML(accountID, inboxID, messageID int) (string, *Response, error)
AsHTML returns formatted HTML email body. Not applicable for plain text emails.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/53cf46462fba5-update-message
func (*MessagesService) AsHTMLSource ¶
func (s *MessagesService) AsHTMLSource(accountID, inboxID, messageID int) (string, *Response, error)
AsHTMLSource returns HTML source of email.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/53cf46462fba5-update-message
func (*MessagesService) AsRaw ¶
func (s *MessagesService) AsRaw(accountID, inboxID, messageID int) (string, *Response, error)
AsRaw returns raw email body.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/53cf46462fba5-update-message
func (*MessagesService) AsText ¶
func (s *MessagesService) AsText(accountID, inboxID, messageID int) (string, *Response, error)
AsText returns text email body, if it exists.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/53cf46462fba5-update-message
func (*MessagesService) Delete ¶
func (s *MessagesService) Delete(accountID, inboxID, messageID int) (*Response, error)
Delete removes message from inbox.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/53cf46462fba5-update-message
func (*MessagesService) Forward ¶
func (s *MessagesService) Forward( accountID, inboxID, messageID int, email string, ) (*Response, error)
Forward forwards message to an email address. The email address must be confirmed by the recipient in advance.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/53cf46462fba5-update-message
func (*MessagesService) Get ¶
func (s *MessagesService) Get(accountID, inboxID, messageID int) (*Message, *Response, error)
Get returns email message with its attributes by ID.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/c1708cf554d6e-show-email-message
func (*MessagesService) List ¶
func (s *MessagesService) List(accountID, inboxID int) ([]*Message, *Response, error)
List returns all messages in inboxs.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/a80869adf4489-get-messages
func (*MessagesService) SpamReport ¶
func (s *MessagesService) SpamReport(accountID, inboxID, messageID int) (*SpamReport, *Response, error)
SpamReport returns a brief spam report by message ID.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/000f54556fc6e-get-message-spam-score
func (*MessagesService) Update ¶
func (s *MessagesService) Update( accountID, inboxID, messageID int, updateReq *UpdateMessageRequest, ) (*Message, *Response, error)
Update updates message attributes.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/53cf46462fba5-update-message
type MessagesServiceContract ¶
type MessagesServiceContract interface { List(accountID, inboxID int) ([]*Message, *Response, error) Get(accountID, inboxID, messageID int) (*Message, *Response, error) Update(accountID, inboxID, messageID int, updateReq *UpdateMessageRequest) (*Message, *Response, error) Delete(accountID, inboxID, messageID int) (*Response, error) Forward(accountID, inboxID, messageID int, email string) (*Response, error) SpamReport(accountID, inboxID, messageID int) (*SpamReport, *Response, error) AsRaw(accountID, inboxID, messageID int) (string, *Response, error) AsText(accountID, inboxID, messageID int) (string, *Response, error) AsHTML(accountID, inboxID, messageID int) (string, *Response, error) AsHTMLSource(accountID, inboxID, messageID int) (string, *Response, error) AsEML(accountID, inboxID, messageID int) (string, *Response, error) }
type PermissionRequest ¶
type PermissionRequest struct { // ResourceID is an ID of the resource. ResourceID int `json:"resource_id,omitempty"` // ResourceType can be account, billing, project, inbox or mailsend_domain. ResourceType string `json:"resource_type,omitempty"` // AccessLevel can be admin or viewer or their numbers 100 and 10 respectively AccessLevel string `json:"access_level,omitempty"` // Destroy - if true, instead of creating/updating the permission, it destroys it Destroy bool `json:"_destroy,omitempty"` }
type Permissions ¶
type Permissions struct { CanRead bool `json:"can_read"` CanUpdate bool `json:"can_update"` CanDestroy bool `json:"can_destroy"` CanLeave bool `json:"can_leave"` }
Permissions represents a Mailtrap permissions schema.
type PermissionsService ¶
type PermissionsService struct {
// contains filtered or unexported fields
}
func (*PermissionsService) ListResources ¶
func (s *PermissionsService) ListResources(accountID int) ([]*Resource, *Response, error)
GetResources returns all resources in account to which the token has admin access.
See https://api-docs.mailtrap.io/docs/mailtrap-api-docs/595e78d9c870b-get-resources
func (*PermissionsService) Manage ¶
func (s *PermissionsService) Manage( accountID, accountAccessID int, permissionReq *[]PermissionRequest, ) (*Response, error)
Manage manages user or token permissions.
If send a combination of resource_type and resource_id that already exists, the permission is updated. If the combination doesn’t exist, the permission is created.
See: https://api-docs.mailtrap.io/docs/mailtrap-api-docs/78d0b711767ea-manage-user-or-token-permissions
type Project ¶
type Project struct { ID int `json:"id"` Name string `json:"name"` Admin string `json:"admin"` Viewer string `json:"viewer"` } `json:"share_links"` Inboxes []Inbox `json:"inboxes"` Permissions Permissions `json:"permissions"` }
Project represents a Mailtrap project.
type ProjectsService ¶
type ProjectsService struct {
// contains filtered or unexported fields
}
func (*ProjectsService) Create ¶
Create creates a Mailtrap project.
See: https://api-docs.mailtrap.io/docs/mailtrap-api-docs/ee252e413d78a-create-project
func (*ProjectsService) Delete ¶
func (s *ProjectsService) Delete(accountID, projectID int) (*Response, error)
Delete removes project and its inboxes.
See: https://api-docs.mailtrap.io/docs/mailtrap-api-docs/e624770632299-delete-project
func (*ProjectsService) Get ¶
func (s *ProjectsService) Get(accountID, projectID int) (*Project, *Response, error)
Get returns the project and its inboxes.
See: https://api-docs.mailtrap.io/docs/mailtrap-api-docs/3c60381e63410-get-project-by-id
func (*ProjectsService) List ¶
func (s *ProjectsService) List(accountID int) ([]*Project, *Response, error)
List returns the list of projects and their inboxes.
See: https://api-docs.mailtrap.io/docs/mailtrap-api-docs/c088109b11d07-get-a-list-of-projects
func (*ProjectsService) Update ¶
func (s *ProjectsService) Update(accountID, projectID int, name string) (*Project, *Response, error)
Update updates project name.
See: https://api-docs.mailtrap.io/docs/mailtrap-api-docs/73bdfaac8c86c-update-project
type ProjectsServiceContract ¶
type ProjectsServiceContract interface { List(accountID int) ([]*Project, *Response, error) Get(accountID, projectID int) (*Project, *Response, error) Create(accountID int, name string) (*Project, *Response, error) Update(accountID, projectID int, name string) (*Project, *Response, error) Delete(accountID, projectID int) (*Response, error) }
ProjectsServiceContract defines the methods available to projects.
type Resource ¶
type Resource struct { ID int `json:"id"` Name string `json:"name"` Type string `json:"type"` // AccessLevel represents the access level of the token used to make the request. AccessLevel int `json:"access_level"` Resource []*Resource `json:"resources"` }
Resource represents the resources nested according to their hierarchy.
type Response ¶
Response is a Mailtrap response. This wraps the standard http.Response returned from Mailtrap.
type SendEmailRequest ¶
type SendEmailRequest struct { From EmailAddress `json:"from"` To []EmailAddress `json:"to"` Cc []EmailAddress `json:"cc"` Bcc []EmailAddress `json:"bcc"` // An array of objects where you can specify any attachments you want to include. Attachments []EmailAttachment `json:"attachments"` // An object containing key/value pairs of header names and the value to substitute for them. // The key/value pairs must be strings. // You must ensure these are properly encoded if they contain unicode characters. // These headers cannot be one of the reserved headers. Headers map[string]string `json:"headers"` // Values that are specific to the entire send that will be carried along with the email and its activity data. // Total size of custom variables in JSON form must not exceed 1000 bytes. CustomVars map[string]string `json:"custom_variables"` // The global or 'message level' subject of your email. // This may be overridden by subject lines set in personalizations. Subject string `json:"subject"` // Text version of the body of the email. Can be used along with html to create a fallback for non-html clients. // Required in the absence of html. Text string `json:"text"` // HTML version of the body of the email. Can be used along with text to create a fallback for non-html clients. // Required in the absence of text. HTML string `json:"html"` Category string `json:"category"` }
SendEmailRequest represents the request to send email.
type SendEmailResponse ¶
type SendEmailResponse struct { Success bool `json:"success"` MessageIDs []string `json:"message_ids"` }
SendEmailResponse contains response from email sending API.
type SendingClient ¶
type SendingClient struct {
// contains filtered or unexported fields
}
SendingClient manages communication with the Mailtrap sending API.
func NewSendingClient ¶
func NewSendingClient(host, apiKey string) (*SendingClient, error)
NewSendingClient creates and returns an instance of SendingClient.
func (*SendingClient) NewRequest ¶
NewRequest creates an API request.
func (*SendingClient) Send ¶
func (sc *SendingClient) Send(request *SendEmailRequest) (*SendEmailResponse, *Response, error)
Send email
See: https://api-docs.mailtrap.io/docs/mailtrap-api-docs/67f1d70aeb62c-send-email
type SpamReport ¶
type SpamReport struct { Report struct { ResponseCode int `json:"ResponseCode"` ResponseMessage string `json:"ResponseMessage"` ResponseVersion string `json:"ResponseVersion"` Score float64 `json:"Score"` Spam bool `json:"Spam"` Threshold float64 `json:"Threshold"` Details []interface{} `json:"Details"` // string or null } `json:"report"` }
SpamReport represents Mailtrap message spam analysis report.
type TestingClient ¶
type TestingClient struct { // Services used for communicating with the Mailtrap testing API. Accounts *AccountsService AccountUsers *AccountUsersService Permissions *PermissionsService Projects *ProjectsService Inboxes *InboxesService Messages *MessagesService Attachments *AttachmentsService // contains filtered or unexported fields }
TestingClient manages communication with the Mailtrap testing API.
func NewTestingClient ¶
func NewTestingClient(apiKey string) (*TestingClient, error)
NewTestingClient creates and returns an instance of TestingClient.
type UpdateInboxRequest ¶
type UpdateMessageRequest ¶
type UpdateMessageRequest struct {
IsRead bool `json:"is_read"`
}