mbxs

package
v0.4.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package mbxs provides functions and types for working with IMAP mailboxes used by applications in this module.

Index

Constants

View Source
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, logger zerolog.Logger) (*client.Client, error)

Connect opens a connection to the specified IMAP server, returns a client connection.

func ListMailboxes added in v0.3.0

func ListMailboxes(c *client.Client, logger zerolog.Logger) ([]string, error)

ListMailboxes lists mailboxes associated with the logged in user account (by way of an IMAP client connection).

func Login added in v0.2.9

func Login(client *client.Client, username string, password string, logger zerolog.Logger) error

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 MailboxCheckResult

type MailboxCheckResult struct {
	MailboxName string
	ItemsFound  int
	Messages    []Message
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL