Documentation
¶
Overview ¶
Package Simap implements a simple Imap client which --Fetches,Copies,Moves emails from mailboxes. --Creates,Deletes Mboxes/Folders on the Server. --Marks,Unmarks Imap Flags from the mails. --Can Skip Certificate Verification of the IMAP Server. (Good for IMAP servers using SelfSigned Cerificates.)
Index ¶
- func BodyOfType(msg *mail.Message, mimetype string) (body io.Reader, err error)
- func CopyEmails(acct *IMAPAccount, src string, dst string, uids []uint32, jobSize int, ...) (err error)
- func CreateMbox(acct *IMAPAccount, name string, skipCerti bool) (err error)
- func DeleteEmails(acct *IMAPAccount, src string, uids []uint32, jobSize int, skipCerti bool) (err error)
- func DeleteMbox(acct *IMAPAccount, name string, skipCerti bool) (err error)
- func Dial(server *IMAPServer, skipCerti bool) (c *imap.Client, err error)
- func FetchAllUIDs(c *imap.Client) (uids []uint32, err error)
- func GetMessageAsJSON(msg MsgData) (msgJSON string, err error)
- func GpgBody(msg *mail.Message) (body string, err error)
- func HTMLBody(msg *mail.Message) (body string, err error)
- func MarkEmails(acct *IMAPAccount, src string, imapFlag string, uids []uint32, jobSize int, ...) (err error)
- func MoveEmails(acct *IMAPAccount, src string, dst string, uids []uint32, jobSize int, ...) (err error)
- func MultipartBodyOfType(msg *mail.Message, mimetype string) (body io.Reader, err error)
- func SearchUIDs(c *imap.Client, query string) (uids []uint32, err error)
- func TextBody(msg *mail.Message) (body string, err error)
- func UnMarkEmails(acct *IMAPAccount, src string, imapFlag string, uids []uint32, jobSize int, ...) (err error)
- func WaitResp(cmd *imap.Command, err error) error
- type IMAPAccount
- type IMAPServer
- type MsgData
- type UIDFetchJob
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyEmails ¶
func CopyEmails(acct *IMAPAccount, src string, dst string, uids []uint32, jobSize int, skipCerti bool) (err error)
CopyEmails copies Emails having unique identifiers uids (NOT sequence numbers) of mailbox src to mailbox dst by making bunches of jobsize. If dst mbox doesnt exist then it will create it. IF skipCerti is true then it will not check for the validity of the Certificate of the IMAP server, good only if IMAP server is using self signed certi. e.g. if jobsize =10 and total emails =100 then it will create 10 bunches of size 10 and then copy them.
func CreateMbox ¶
func CreateMbox(acct *IMAPAccount, name string, skipCerti bool) (err error)
CreateMbox creates a mailbox/folder on the server If already exists then do nothing IF skipCerti is true then it will not check for the validity of the Certificate of the IMAP server, good only if IMAP server is using self signed certi.
func DeleteEmails ¶
func DeleteEmails(acct *IMAPAccount, src string, uids []uint32, jobSize int, skipCerti bool) (err error)
DeleteEMails deletes mails having uids from src.Arguments have same meaning as CopyEmails
func DeleteMbox ¶
func DeleteMbox(acct *IMAPAccount, name string, skipCerti bool) (err error)
DeleteMbox deletes a mailbox/folder on the server If does not exist then do nothing
func Dial ¶
func Dial(server *IMAPServer, skipCerti bool) (c *imap.Client, err error)
Dial dials a connection to the IMAP server If skipCerti is true then it will not check for the validity of the Certificate of the IMAP server, good only if IMAP server is using self signed certi.
func GetMessageAsJSON ¶
func MarkEmails ¶
func MarkEmails(acct *IMAPAccount, src string, imapFlag string, uids []uint32, jobSize int, skipCerti bool) (err error)
MarkEmails marks mails having uids from src with IMAP flag specified in imapFlag. See RFC 3501 section 2.3.2 for a list of all valid flags.
func MoveEmails ¶
func MoveEmails(acct *IMAPAccount, src string, dst string, uids []uint32, jobSize int, skipCerti bool) (err error)
MoveEmails is similar to CopyEmails but it moves the mails to dst hence deleting mails from src.
func MultipartBodyOfType ¶
func UnMarkEmails ¶
func UnMarkEmails(acct *IMAPAccount, src string, imapFlag string, uids []uint32, jobSize int, skipCerti bool) (err error)
UnmarkEmails unmarks/resets flags of mails having uids from src with IMAP flag specified in imapFlag. See RFC 3501 section 2.3.2 for a list of all valid flags.
Types ¶
type IMAPAccount ¶
type IMAPAccount struct { Username string Password string Server *IMAPServer }
type IMAPServer ¶
type MsgData ¶
type MsgData struct { Imap_uid uint32 From string To string Subject string Body string HtmlBody string GpgBody string Header mail.Header }
func FetchMessages ¶
func GetEMails ¶
func GetEMails(acct *IMAPAccount, query string, mbox string, jobSize int, skipCerti bool) (mails []MsgData, err error)
GetEmails gets Emails from mailbox mbox in Struct of Type MsgData. It searches the mailbox for messages that match the given searching criteria mentioned in query string. See RFC 3501 section 6.4.4 for a list of all valid search keys. It is the caller's responsibility to quote strings when necessary. All strings must use UTF-8 encoding.
type UIDFetchJob ¶
type UIDFetchJob struct {
// contains filtered or unexported fields
}