Documentation
¶
Index ¶
- Variables
- func DeleteEmails(info MailboxInfo, uids []uint32) error
- func GenerateAll(info MailboxInfo, markAsRead, delete bool) (chan Response, error)
- func GenerateCommand(info MailboxInfo, IMAPCommand string, markAsRead, delete bool) (chan Response, error)
- func GenerateSince(info MailboxInfo, since time.Time, markAsRead, delete bool) (chan Response, error)
- func GenerateUnread(info MailboxInfo, markAsRead, delete bool) (chan Response, error)
- func MarkAsUnread(info MailboxInfo, uids []uint32) error
- func ValidateMailboxInfo(info MailboxInfo) error
- func VisibleText(body io.Reader) ([][]byte, error)
- type Email
- func GetAll(info MailboxInfo, markAsRead, delete bool) ([]Email, error)
- func GetCommand(info MailboxInfo, IMAPCommand string, markAsRead, delete bool) ([]Email, error)
- func GetSince(info MailboxInfo, since time.Time, markAsRead, delete bool) ([]Email, error)
- func GetUnread(info MailboxInfo, markAsRead, delete bool) ([]Email, error)
- func NewEmail(msgFields imap.FieldMap) (Email, error)
- type MailboxInfo
- type Response
Constants ¶
This section is empty.
Variables ¶
var GenerateBufferSize = 100
Functions ¶
func DeleteEmails ¶
func DeleteEmails(info MailboxInfo, uids []uint32) error
DeleteEmails will delete emails from the supplied slice of UIDs
func GenerateAll ¶
func GenerateAll(info MailboxInfo, markAsRead, delete bool) (chan Response, error)
GenerateAll will find all emails in the email folder and pass them along to the responses channel.
func GenerateCommand ¶
func GenerateCommand(info MailboxInfo, IMAPCommand string, markAsRead, delete bool) (chan Response, error)
GenerateCommand will find all emails in the email folder matching the IMAP command and pass them along to the responses channel.
func GenerateSince ¶
func GenerateSince(info MailboxInfo, since time.Time, markAsRead, delete bool) (chan Response, error)
GenerateSince will find all emails that have an internal date after the given time and pass them along to the responses channel.
func GenerateUnread ¶
func GenerateUnread(info MailboxInfo, markAsRead, delete bool) (chan Response, error)
GenerateUnread will find all unread emails in the folder and pass them along to the responses channel.
func MarkAsUnread ¶
func MarkAsUnread(info MailboxInfo, uids []uint32) error
MarkAsUnread will set the UNSEEN flag on a supplied slice of UIDs
func ValidateMailboxInfo ¶
func ValidateMailboxInfo(info MailboxInfo) error
ValidateMailboxInfo attempts to login to the supplied IMAP account to ensure the info is correct
Types ¶
type Email ¶
type Email struct { Message *mail.Message From *mail.Address `json:"from"` To []*mail.Address `json:"to"` InternalDate time.Time `json:"internal_date"` Precedence string `json:"precedence"` Subject string `json:"subject"` HTML []byte `json:"html"` Text []byte `json:"text"` IsMultiPart bool `json:"is_multipart"` UID uint32 `json:"uid"` }
Email is a simplified email struct containing the basic pieces of an email. If you want more info, it should all be available within the Message attribute.
func GetAll ¶
func GetAll(info MailboxInfo, markAsRead, delete bool) ([]Email, error)
GetAll will pull all emails from the email folder and return them as a list.
func GetCommand ¶
func GetCommand(info MailboxInfo, IMAPCommand string, markAsRead, delete bool) ([]Email, error)
GetCommand will pull all emails that match the provided IMAP Command. Examples of IMAP Commands include TO/FROM/BCC, some examples are here http://www.marshallsoft.com/ImapSearch.htm
func GetUnread ¶
func GetUnread(info MailboxInfo, markAsRead, delete bool) ([]Email, error)
GetUnread will find all unread emails in the folder and return them as a list.
func NewEmail ¶
NewEmail will parse an imap.FieldMap into an Email. This will expect the message to container the internaldate and the body with all headers included.
func (*Email) VisibleText ¶
VisibleText will return any visible text from an HTML email body.
type MailboxInfo ¶
type MailboxInfo struct { Host string TLS bool InsecureSkipVerify bool User string Pwd string Folder string // Read only mode, false (original logic) if not initialized ReadOnly bool }
MailboxInfo holds onto the credentials and other information needed for connecting to an IMAP server.