C# Class Joshi.Utils.Imap.Imap

Imap class implementes IMAP client API
Inheritance: ImapBase
Exibir arquivo Open project: rohitjoshi/ImapLibrary Class Usage Examples

Public Methods

Method Description
CopyMessage ( string sUid, string sFolderName ) : void

Copy Message

ExamineFolder ( string sFolder ) : void

Examine the sFolder/mailbox after login

Expunge ( ) : void

Expunge

FetchMessage ( string sMessageUID, XmlTextWriter oXmlWriter, bool bFetchBody ) : void

Fetch the full message

FetchPartBody ( string sMessageUID, string sMessagePart, string &sData ) : void

Fetch the body for specified part

FetchPartHeader ( string sMessageUID, string sMessagePart, ArrayList asMessageHeader ) : void

Fetch Header of the message uid and part

GetMessageSize ( string sUid ) : long

Get the message size

GetQuota ( string sFolderName, bool &bUnlimitedQuota, int &nUsedKBytes, int &nTotalKBytes ) : void

Get the quota for specific folder

HasEnoughQuota ( string sFolderName ) : bool

Check if enough quota is available

IsMultipart ( ArrayList asHeader ) : bool

Check if this message is multipart To Identify multipart message, the content-type is either multipart or rfc822

LogOut ( ) : void

Logout the user: It logout the user and disconnect the connetion from IMAP server.

Login ( string sHost, string sUserId, string sPassword ) : void

Login to specified Imap host and default port (143)

Login ( string sHost, ushort nPort, string sUserId, string sPassword, bool sslEnabled = false ) : void

Login to specified Imap host and port

MoveMessage ( string sUid, string sFolderName ) : void

Move message to specified folder

SearchMessage ( string asSearchData, bool bExactMatch, ArrayList asSearchResult ) : void

Search the messages by specified criterias

SelectFolder ( string sFolder ) : void

Select the sFolder/mailbox after login

SetFlag ( string sUid, string flag, bool removeFlag = false ) : void

Store flag

Private Methods

Method Description
FindAndRemove ( string &sBodyStruct, char ch ) : bool

find the given character and remove

GetBody ( string sMessageUid, string sPartNumber, string &sData ) : void

Get the message body for specified part

GetBodyStructure ( string sMessageUID, XmlTextWriter oXmlWriter, bool bFetchBody ) : void

Get the Body structure of the message. If message is single part then first part is 1 If message is multipart then first part is 0

GetContentDisposition ( string &sBodyStruct, string &sDisp ) : bool

Get Content Disposition

GetContentType ( string &sBodyStruct, string &sType, string &sSubType, string &sContentType ) : bool

Get the content type

GetHeader ( string sMessageUid, string sPartNumber, ArrayList asMessageHeader ) : void

Get the header for specific partNumber and Message UID

GetResponseSize ( string sResponse ) : long

Get the Size of the fetch command response response will look like "{}"

IsNilString ( string &sBodyStruct ) : bool

Returns true if starts with NIL

ParseAddress ( string &sBodyStruct, string &sString ) : bool

Parse one address and format the string

ParseAddressList ( string &sBodyStruct, string &sString ) : bool

Parse the address string

ParseBodyStructure ( string sMessageUID, string &sBodyStruct, XmlTextWriter oXmlBodyPart, string sPartPrefix, bool bFetchBody ) : bool

Parse the bodystructure and store as XML Element

ParseEnvelope ( string &sBodyStruct, ArrayList asAttrs ) : bool
ParseExtension ( string &sBodyStruct, string &sString ) : bool

Parse the extension in body structure

ParseLanguage ( string &sBodyStruct, string &sString ) : bool

Parse the language or list of languages in body structure

ParseParameters ( string &sBodyStruct, ArrayList asParams ) : bool

Parse the parameter in body structure

ParseQuotedString ( string &sBodyStruct, string &sString ) : bool

Parse the quoted string in body structure

ParseString ( string &sBodyStruct, string &sString ) : bool

Parse the string (seperated by spaces or parenthesis)

Restore ( bool bSelectFolder ) : void

Restore the connection using available old data Select the sFolder if previously selected

Method Details

CopyMessage() public method

Copy Message
public CopyMessage ( string sUid, string sFolderName ) : void
sUid string Either UID or range of uid e.g 1:2
sFolderName string Folder where it needs to be copied
return void

ExamineFolder() public method

Examine the sFolder/mailbox after login
public ExamineFolder ( string sFolder ) : void
sFolder string Mailbox folder
return void

Expunge() public method

Expunge
public Expunge ( ) : void
return void

FetchMessage() public method

Fetch the full message
public FetchMessage ( string sMessageUID, XmlTextWriter oXmlWriter, bool bFetchBody ) : void
sMessageUID string Message UID
oXmlWriter System.Xml.XmlTextWriter
bFetchBody bool
return void

FetchPartBody() public method

Fetch the body for specified part
public FetchPartBody ( string sMessageUID, string sMessagePart, string &sData ) : void
sMessageUID string Message uid
sMessagePart string Message part
sData string
return void

FetchPartHeader() public method

Fetch Header of the message uid and part
public FetchPartHeader ( string sMessageUID, string sMessagePart, ArrayList asMessageHeader ) : void
sMessageUID string Message UID
sMessagePart string Message part
asMessageHeader System.Collections.ArrayList Output Array
return void

GetMessageSize() public method

Get the message size
public GetMessageSize ( string sUid ) : long
sUid string
return long

GetQuota() public method

Get the quota for specific folder
public GetQuota ( string sFolderName, bool &bUnlimitedQuota, int &nUsedKBytes, int &nTotalKBytes ) : void
sFolderName string Mailbox folder
bUnlimitedQuota bool Is unlimited quota
nUsedKBytes int Used quota in Kbytes
nTotalKBytes int Total quota in KBytes
return void

HasEnoughQuota() public method

Check if enough quota is available
public HasEnoughQuota ( string sFolderName ) : bool
sFolderName string Mailbox folder
return bool

IsMultipart() public method

Check if this message is multipart To Identify multipart message, the content-type is either multipart or rfc822
public IsMultipart ( ArrayList asHeader ) : bool
asHeader System.Collections.ArrayList
return bool

LogOut() public method

Logout the user: It logout the user and disconnect the connetion from IMAP server.
public LogOut ( ) : void
return void

Login() public method

Login to specified Imap host and default port (143)
public Login ( string sHost, string sUserId, string sPassword ) : void
sHost string Imap Server name
sUserId string User's login id
sPassword string User's password
return void

Login() public method

Login to specified Imap host and port
public Login ( string sHost, ushort nPort, string sUserId, string sPassword, bool sslEnabled = false ) : void
sHost string Imap server name
nPort ushort Imap server port
sUserId string User's login id
sPassword string User's password
sslEnabled bool
return void

MoveMessage() public method

Move message to specified folder
public MoveMessage ( string sUid, string sFolderName ) : void
sUid string UID of the message
sFolderName string Folder where you want to move the message
return void

SearchMessage() public method

Search the messages by specified criterias
public SearchMessage ( string asSearchData, bool bExactMatch, ArrayList asSearchResult ) : void
asSearchData string Search criterias
bExactMatch bool Is it exact search
asSearchResult System.Collections.ArrayList search result
return void

SelectFolder() public method

Select the sFolder/mailbox after login
public SelectFolder ( string sFolder ) : void
sFolder string mailbox folder
return void

SetFlag() public method

Store flag
public SetFlag ( string sUid, string flag, bool removeFlag = false ) : void
sUid string
flag string E.g \Deleted
removeFlag bool Remove the flaf
return void