Comments (13)
What you're looking for is MessageSummaryItems.Flags (and IMessageSummary.Flags).
Then, what you want to do is check for the MessageFlags.Flagged value (which is aka "important").
from mimekit.
Thanks for the quick response
from mimekit.
For some reason I don't see the flagged value in the Flags. According to the log the only message in my inbox (that I did put there as important) seems to be flagged. But when I look into the IMessageSummary.Flags I only see [Seen | Deleted]. Flagged is never in the list.
This is the code I use to retrieve the messages:
using (var client = new ImapClient(new ProtocolLogger("d:\log.txt")))
{
client.Connect(Server, 993, true);
client.AuthenticationMechanisms.Remove("XOAUTH");
client.Authenticate(User, Password);
client.Inbox.Open(FolderAccess.ReadOnly);
const MessageSummaryItems items =
MessageSummaryItems.UniqueId |
MessageSummaryItems.Flags |
MessageSummaryItems.Envelope |
MessageSummaryItems.MessageSize;
var result = client.Inbox.Count == 0 ? new IMessageSummary[0] : client.Inbox.Fetch(0, -1, items);
client.Disconnect(true);
return result;
}
S: Z00000001 OK AUTHENTICATE completed.
C: Z00000002 CAPABILITY
S: * CAPABILITY IMAP4 IMAP4rev1 AUTH=NTLM AUTH=GSSAPI AUTH=PLAIN IDLE NAMESPACE LITERAL+
S: Z00000002 OK CAPABILITY completed.
C: Z00000003 NAMESPACE
S: * NAMESPACE (("" "/")) NIL NIL
S: Z00000003 OK NAMESPACE completed.
C: Z00000004 LIST "" "INBOX"
S: * LIST (\Marked \HasNoChildren) "/" INBOX
S: Z00000004 OK LIST completed.
C: Z00000005 EXAMINE INBOX
S: * 1 EXISTS
S: * 0 RECENT
S: * FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
from mimekit.
Do any of the messages have \Flagged in their flag list in the server response?
from mimekit.
I did put 2 E-mails in the inbox:
- One with prio low flag set
- One with prio high flag set
from mimekit.
You mean MailKit (MimeKit just parses messages, it doesn't do IMAP).
Anyway, I thought you were asking about something else (no IMAP client uses the message headers to determine importance, they all use the IMAP \Flagged flag).
But anyway, if you want the Importance
, Priority
, X-Priority
, X-MSMail-Priority
, etc headers, then what you need to do is download the message headers for each message and check them.
from mimekit.
I've just committed a patch to MailKit to allow fetching specific headers along with the summaries.
You can now do:
const MessageSummaryItems items =
MessageSummaryItems.UniqueId |
MessageSummaryItems.Flags |
MessageSummaryItems.Envelope |
MessageSummaryItems.MessageSize;
HashSet<HeaderId> fields = new HashSet<HeaderId> ();
fields.Add (HeaderId.Importance);
var result = client.Inbox.Count == 0 ? new IMessageSummary[0] : client.Inbox.Fetch(0, -1, items, fields);
from mimekit.
Thanks for implementing, is this also in the nuget package or do I need to download the code from Git hub?
from mimekit.
I haven't released it as a NuGet package yet, but I can do that tonight or tomorrow morning (depending on when I get home tonight)
from mimekit.
Just another question... looking to your avatar on GitHub... are you a mountainbiker? If so then we share a second thing... like to code and like to mountainbike :-)
Also my apologies for my terrible English... not always used to talk a lot in English since Dutch is my native language :-)
from mimekit.
I actually am more into road biking (the photo of me is actually biking on the road through a park)
from mimekit.
I also checked your TNEF implementation.. while it looks a lot like the MAPI things I don't think it covers everything what I use. I see a lot of MAPI properties that are the same but there are also differences. One other thing is that a MSG file also uses named MAPI properties and those you have to get from the __nameid_version1.0 stream in a msg object. It took me some time to figure out how to map the named properties. The problem is that named properties not always have the same tags. One time the property can be value 8010 and the second time it can be 8040... etc... you have to look them up in the __nameid_version1.0 stream. The mappings are somewhat encrypted. You need to read the bits and bytes from the stream in a defined order and then swap the bytes because they are in little endian. It took me some time to figure that out.... see the MapiTagMapperClass.
/// <summary>
/// The stream that contains all the MAPI properties
/// </summary>
public const string PropertiesStream = "__properties_version1.0";
/// <summary>
/// Contains the streams needed to perform named property mapping
/// </summary>
public const string NameIdStorage = "__nameid_version1.0";
from mimekit.
interesting... thanks for the info. Doing a bit more reading, it looks like TNEF encapsulates only a subset of MAPI.
from mimekit.
Related Issues (20)
- HTML base64 to CID conversion HOT 1
- Punycode encoding being improperly used for email local parts HOT 1
- Make more packages conditional based on TFM HOT 3
- Will the order of the `MimeMessage.Attachments` (i.e., `MimeMessage.EnumerateMimeParts`) enumeration be permanent? HOT 1
- Error using smtprelay server.com Port 25. HOT 1
- Could not load file or assembly 'System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 HOT 1
- The PGP key server query builder omits leading zero(s) in 'keyId' parameter HOT 1
- Problem compiling tag 3.0.0 in x64 HOT 2
- Update BouncyCastle.Cryptography to 2.3.1 HOT 3
- PgpCore / MimeKit? HOT 2
- MimeKitLite not bumped to v4.6.0 on NuGet HOT 1
- SQLite is not available. Install the System.Data.SQLite nuget package. HOT 1
- Setting the attachment code is invalid HOT 12
- MimeKit is parsing address as `GroupAddress` instead of `MailboxAddress` HOT 2
- From returns blank when it contains special characters HOT 6
- Add an image as an in line signature HOT 3
- Mimekit 3.3+ Japanese CP encoding regression? HOT 1
- message/rfc822 attachment with blank Content-Transfer-Encoding header causes attachment to become corrupted when loaded and prepared by mimekit HOT 5
- ERROR: The type initializer for 'PerTypeValues1' threw an exception. HOT 3
- "|" and English cannot be correctly transcoded together HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mimekit.