Dart.Mail Namespace : ImapCriterion Enumeration |
Public Enum ImapCriterion Inherits System.Enum
Dim instance As ImapCriterion
public enum ImapCriterion : System.Enum
__value public enum ImapCriterion : public System.Enum
public enum class ImapCriterion : public System.Enum
Member | Description |
---|---|
All | Search for all messages (no restrictions). No search parameter is required. |
Answered | Search for all answered messages (messages that have the Answered flag set). No search parameter is required. |
Bcc | Search for messages that contain the specified string in the BCC field of the message envelope. |
Before | Search for messages with an earlier internal date than the specified date. |
Body | Search for messages that contain the specified string in the message body. |
Cc | Search for messages that contain the specified string in the CC field of the message envelope. |
Deleted | Search for deleted messages (messages that have the Deleted flag set). No search parameter is required. |
Draft | Search for draft messages (messages that have the Draft flag set). No search parameter is required. |
Flagged | Search for flagged messages (messages that have the Flagged flag set). No search parameter is required. |
From | Search for messages that contain the specified string in the FROM field of the message envelope. |
Header | Search for messages that contain the specified string in the message header. Note that the format requires that the header field be specified, so the parameter value for this search criterion should be "<header> <value>". |
Keyword | Search for messages that have the specified keyword flag set. This allows for searches based on custom flag types. |
Larger | Search for messages larger than the specified byte count. |
New | Search for all recent and unseen messages (messages with the Recent flag set but not the Seen flag). No search parameter is required. |
Not | Perform a logical inversion (NOT operation) on another search criterion. No search parameter is required if this is part of a collection of ImapSearchParameters and another search criterion follows this one; otherwise, a search parameter is required. |
NotAnswered | Search for messages that do not have the Answered flag set. No search parameter is required. |
NotDeleted | Search for messages that do not have the Deleted flag set. No search parameter is required. |
NotDraft | Search for messages that do not have the Draft flag set. No search parameter is required. |
NotFlagged | Search for messages that do not have the Flagged flag set. No search parameter is required. |
NotKeyword | Search for messages that do not have the specified keyword flag set. This allows for searches based on custom flag types. |
NotSeen | Search for messages that do not have the Seen flag set. No search parameter is required. |
Old | Search for messages that do not have the Recent flag set. No search parameter is required. |
On | Search for messages that have an internal date that exactly matches the value specified (disregarding time). |
Or | Perform a logical OR operation on the two search criterion that follow this one. This search parameter must be followed by two other search parameters; these will represent the conditions to be ORed. |
Recent | Search for recent messages (messages that have the Recent flag set). No search parameter is required. |
Seen | Search for seen messages (messages that have the Seen flag set). No search parameter is required. |
SentBefore | Search for messages sent before the specified date. |
SentOn | Search for messages sent on the specified date. |
SentSince | Search for messages with an internal date later than the specified date. |
Since | Search for messages sent after the specified date. |
Smaller | Search for messages smaller than the specified byte count. |
Subject | Search for messages that contain the specified string in the message subject. |
Text | Search for messages that contain the specified string in either the header or body of the message. |
To | Search for messages that contain the specified string in the TO field of the message. |
Uid | Search for messages that match the UID or range of UIDs specified. Ranges of UIDs can be specified using the format "<start>:<end>". |
This enumeration specifies search restrictions for the Mailbox.Search method. Use this enumeration with the ImapSearchParameter class to create custom searches of an IMAP mailbox.
private void getMessages(object state) { //Configure server and account info imap1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session)); imap1.Session.Username = myUsername; imap1.Session.Password = myPassword; //Connect and log into the account imap1.Connect(); imap1.Authenticate(); //Set the selected mailbox to the Inbox imap1.SelectedMailbox = imap1.Mailboxes["INBOX"]; // Construct the search "SEARCH SINCE 1-Jan-2012 NOT FROM JACKSON" ImapSearchParameter[] criteria = new ImapSearchParameter[] { new ImapSearchParameter(ImapCriterion.Since, "1-Jan-2012"), new ImapSearchParameter(ImapCriterion.Not, ""), new ImapSearchParameter(ImapCriterion.From, "JACKSON") }; // Perform the search ImapMessage[] messages = imap1.SelectedMailbox.Search(criteria); //Copy all messages that meet the criteria to the 'Save' mailbox foreach (ImapMessage imapMessage in messages) imapMessage.CopyTo(imap1.Mailboxes["Save"]); //Gracefully logout imap1.Close(); }
Private Sub getMessages(ByVal state As Object) 'Configure server and account info imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session)) imap1.Session.Username = myUsername imap1.Session.Password = myPassword 'Connect and log into the account imap1.Connect() imap1.Authenticate() 'Set the selected mailbox to the Inbox imap1.SelectedMailbox = imap1.Mailboxes("INBOX") ' Construct the search "SEARCH SINCE 1-Jan-2012 NOT FROM JACKSON" Dim criteria() As ImapSearchParameter = { New ImapSearchParameter(ImapCriterion.Since, "1-Jan-2012"), New ImapSearchParameter(ImapCriterion.Not, ""), New ImapSearchParameter(ImapCriterion.From, "JACKSON") } ' Perform the search Dim messages() As ImapMessage = imap1.SelectedMailbox.Search(criteria) 'Copy all messages that meet the criteria to the 'Save' mailbox For Each imapMessage As ImapMessage In messages imapMessage.CopyTo(imap1.Mailboxes("Save")) Next imapMessage 'Gracefully logout imap1.Close() End Sub
System.Object
System.ValueType
System.Enum
Dart.Mail.ImapCriterion