Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type SendRequest ¶
type SendRequest struct { To []string `json:"to" binding:"required"` Subject string `json:"subject" binding:"required"` Body string `json:"body" binding:"required"` }
SendRequest is a request to send an email to the specified 'to' addresses.
type SendStatus ¶
type SendStatus struct { ID string `json:"id" binding:"required"` Status string `json:"status" binding:"required"` Failed []string `json:"failed" binding:"required"` }
SendStatus tracks the status of a SendRequest. If status is "completed", then Failed are the destination addresses that could not be reached. TODO: keep error messages on failed addresses.
type Sender ¶
type Sender struct {
// contains filtered or unexported fields
}
Sender maintains a queue of send requests and their status, and attempts to process them.
func NewSender ¶
NewSender initializes a new sender with the given src string. Returns nil if src is an invalid email address.
func (*Sender) Enqueue ¶
func (s *Sender) Enqueue(req SendRequest) string
Enqueue a request to the processing queue and return a reference ID.
func (*Sender) GetStatus ¶
func (s *Sender) GetStatus(ref string) SendStatus
GetStatus returns the status of a request by looking up its reference ID.
Click to show internal directories.
Click to hide internal directories.