Documentation
¶
Overview ¶
Package mbxs provides functions and types for working with IMAP mailboxes used by applications in this module.
Index ¶
- Constants
- func Connect(server string, port int, netType string, minTLSVer uint16, ...) (*client.Client, error)
- func ListMailboxes(c *client.Client, logger zerolog.Logger) ([]string, error)
- func Login(client *client.Client, username string, password string, logger zerolog.Logger) error
- func ValidateMailboxesList(c *client.Client, userMBXList []string, logger zerolog.Logger) ([]string, error)
- type Dialer
- type MailboxCheckResult
- type MailboxCheckResults
- type Message
Constants ¶
const ( // NetTypeTCPAuto indicates that either of IPv4 or IPv6 will be used to // establish a connection depending on the specified IP Address. NetTypeTCPAuto string = "tcp" // NetTypeTCP4 indicates an IPv4-only network. NetTypeTCP4 string = "tcp4" // NetTypeTCP6 indicates an IPv6-only network. NetTypeTCP6 string = "tcp6" )
Known, named networks used for IMAP connections. These names match the network names used by the `net` standard library package.
const DefaultReplacementString string = textutils.EmojiScissors
DefaultReplacementString is used when replacing Unicode characters incompatible with a target character set. The common use case is substituting Unicode characters incompatible with the utf8mb3 character set.
Variables ¶
This section is empty.
Functions ¶
func Connect ¶ added in v0.2.9
func Connect(server string, port int, netType string, minTLSVer uint16, logger zerolog.Logger) (*client.Client, error)
Connect opens a connection to the specified IMAP server using the specified network type, returns a client connection or an error if one occurs.
func ListMailboxes ¶ added in v0.3.0
ListMailboxes lists mailboxes associated with the logged in user account (by way of an IMAP client connection).
func Login ¶ added in v0.2.9
Login uses the provided client connection and credentials to login to the remote server.
func ValidateMailboxesList ¶ added in v0.3.0
func ValidateMailboxesList(c *client.Client, userMBXList []string, logger zerolog.Logger) ([]string, error)
ValidateMailboxesList receives a list of requested mailboxes and returns a list of mailboxes from that list which have been confirmed to be present for the associated user account.
Types ¶
type Dialer ¶ added in v0.4.5
type Dialer struct { // If specified, this value overrides the value supplied to // `go-imap/client.Dial*` functions and is used in its place to establish // a connection on the user-specified network type. NetworkTypeUserOverride string // Original value supplied to `go-imap/client.Dial*` functions. Unless // overridden by the user, this value is used to establish a connection on // the supplied network type. NetworkTypeOriginalValue string }
Dialer is an implementation of the go-imap/client.Dialer interface. This implementation is used to override the default "auto" network type selection behavior applied by `Dial*` functions within the go-imap/client package.
type MailboxCheckResult ¶
MailboxCheckResult records mail items found for a specific mailbox.
type MailboxCheckResults ¶
type MailboxCheckResults []MailboxCheckResult
MailboxCheckResults represents a collection of all results from mailbox checks.
func CheckMail ¶ added in v0.3.0
func CheckMail(c *client.Client, username string, validatedMBXList []string, logger zerolog.Logger) (MailboxCheckResults, error)
CheckMail generates a listing of emails within the provided (and validated) mailbox list for the associated username.
func (MailboxCheckResults) GotMail ¶
func (mcr MailboxCheckResults) GotMail() bool
GotMail returns true if mail was found in checked mailboxes or false if not.
func (MailboxCheckResults) MessagesFoundSummary ¶
func (mcr MailboxCheckResults) MessagesFoundSummary() string
MessagesFoundSummary returns a one-line summary of the mail items found in checked mailboxes.
func (MailboxCheckResults) TotalMessagesFound ¶
func (mcr MailboxCheckResults) TotalMessagesFound() int
TotalMessagesFound returns a count of all messages found across all checked mailboxes.
type Message ¶ added in v0.3.0
type Message struct { // MessageID is the unique ID for an email message found within a // specified mailbox. MessageID string // EnvelopeDate is the crafted date value for an email message found // within a specific mailbox. This is the date set by the mail transport // software that initially received the email message from the mail // client. While this can be incorrect or forged, it is generally more // reliable than the date email header value. EnvelopeDate time.Time // EnvelopeDateFormatted is a date/time value stored as a string for later // use with templates. EnvelopeDateFormatted string // OriginalSubject is the unmodified, original subject line of an email // message found within a specificed mailbox. OriginalSubject string // ModifiedSubject is the subject line of the original email message that // has been modified to remove characters incompatible with the a target // character set (e.g., MySQL's utf8mb3). ModifiedSubject string }
Message is a subset of attributes for an email message found within a specified mailbox.