Flag types, used on folders and messages.
This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.
Flags provide a small set of standard attributes that most clients user. All system flags are prefixed with a '\' character. The following is a list of basic flags:
\answered
The \answered flag is set on a message by a client when it sends a reply. A client must explicitly set the flag. It is not set by the server, only stored and maintained.
\deleted
The \deleted flag is also set by the client. The client marks the message for deletion. Its not until Purge(), commonly known as Expunge, is called that the messages are physically removed from the server. See Delete(), CancelDelete(), and PurgeDeletedMessages() for more information.
\draft
When composing a message, or replying to a message, you may want to suspend editing, or save for a later date. IMAP allows the client to store the message on the server with the \draft flag set. This allows the client to identify the message as a draft for later editing.
\flagged
A client can mark a message as "important", "flagged", or "marked" by setting the \flagged flag. Users can assign their own meaning to the flag, since unlike the other flags, \flagged has not special semantics.
\recent
\recent is a slightly more complicated flag than the others. When a new message arrives, the server sets the \recent flag, for the first \client to see it. The \recent flag can be queried by clients to determine if there are any new messages on the server, since the last time messages were checked.
\seen
The last flag, is the \seen flag. It is also commonly referred to as the "read" flag, and is set when a message is read. Some methods allow you to read messages without setting the \seen flag. These methods can be found on the FetchClient, and and mark as message as read by setting the "markAsRead" parameter to true.
[C#]
IMAP4 imap = new IMAP4( "127.0.0.1" );
imap.Username = "dave@blah.com";
imap.Password = "test";
imap.Login();
//grab the inbox
MailFolder mf = imap.SelectInbox();
//get the information about the first message
FastItem item = mf.FetchClient.Fast( 1, IndexType.Ordinal );
imap.Disconnect();
//check out the flags
FlagCollection fc = item.Flags;
foreach( Flag f in fc )
{
Console.WriteLine( f.FlagType );
Console.WriteLine( f.Value );
Console.WriteLine( f.ToString() );
}
Console.WriteLine( "Done" );
Console.ReadLine();
[VB.NET]
Dim imap As New IMAP4("127.0.0.1")
imap.Username = "dave@blah.com"
imap.Password = "test"
imap.Login()
'grab the inbox
Dim mf As MailFolder = imap.SelectInbox()
'get the information about the first message
Dim item As FastItem = mf.FetchClient.Fast(1, IndexType.Ordinal)
imap.Disconnect()
'check out the flags
Dim fc As FlagCollection = item.Flags
Dim f As Flag
For Each f In fc
Console.WriteLine(f.FlagType)
Console.WriteLine(f.Value)
Console.WriteLine(f.ToString())
Next f
Console.WriteLine("Done")
Console.ReadLine()
| Member Name | Description | Value |
|---|---|---|
| None | No Flag is used | 0 |
| Answered | Message marked as answered. | 1 |
| Deleted | Message marked for deletion. | 2 |
| Draft | Message marked as a draft. | 4 |
| Flagged | Message flagged. | 8 |
| Recent | Recent, unread message | 16 |
| Seen | Message seen or read. | 32 |
| Unknown | An unknown, or custom flag. | 64 |
Namespace: aspNetIMAP
Assembly: aspNetIMAP (in aspNetIMAP.dll)