Comments (15)
That UID is not a global. As far as I'm aware, it's only unique for the duration of the connection, and only IMAP provides it. It isn't part of the actual message data, which is why it isn't persisted.
from aenetmail.
I thought that the uid was a "unique id" that the server would give to each email received in order to easily browse the server's messages (ie unique but only for the current mail account).
Wikipedia tends to say so too but I admit that I have no advanced network knowledge nor serious source to support my opinion.
About POP3 and IMAP uids :
"Clients that leave mail on servers generally use the UIDL command to get the current association of message-numbers to message identified by its unique identifier. The unique identifier is arbitrary, and might be repeated if the mailbox contains identical messages. In contrast, IMAP uses a 32-bit unique identifier (UID) that is assigned to messages in ascending (although not necessarily consecutive) order as they are received. When retrieving new messages, an IMAP client requests the UIDs greater than the highest UID among all previously-retrieved messages, whereas a POP client must fetch the entire UIDL map. For large mailboxes, this can require significant processing." (Wikipedia)
Anyway, I can still use the message-id which is supposed to be unique on the whole web but it's more heavy and doesn't allow me to know quickly if a message is prior to another one.
from aenetmail.
Well, I know that in Gmail, their "UID" is only unique for a connection. What about using the MailMessage.Date
property for this?
-----Original Message-----
From: piher [mailto:[email protected]]
Sent: Friday, January 06, 2012 10:20 AM
To: Andy Edinborough
Subject: Re: [aenetmail] Load method not loading uid ? (#19)
I thought that the uid was a "unique id" that the server would give to each email received in order to easily browse the server's messages (ie unique but only for the current mail account).
Wikipedia tends to say so too but I admit that I have no advanced network knowledge nor serious source to support my opinion.
About POP3 and IMAP uids :
"Clients that leave mail on servers generally use the UIDL command to get the current association of message-numbers to message identified by its unique identifier. The unique identifier is arbitrary, and might be repeated if the mailbox contains identical messages. In contrast, IMAP uses a 32-bit unique identifier (UID) that is assigned to messages in ascending (although not necessarily consecutive) order as they are received. When retrieving new messages, an IMAP client requests the UIDs greater than the highest UID among all previously-retrieved messages, whereas a POP client must fetch the entire UIDL map. For large mailboxes, this can require significant processing." (Wikipedia)
Anyway, I can still use the message-id which is supposed to be unique on the whole web but it's more heavy and doesn't allow me to know quickly if a message is prior to another one.
Reply to this email directly or view it on GitHub:
#19 (comment)
from aenetmail.
Okay that's good to know. Ordering the messages was not really an issue, it would have been more simple using a uid but that's no big deal I can use the date as you said.
My problematic was about saving the emails and associating an id to each of them to know which ones I've already fetched but i guess i'll juste use the message-id property for that.
Thanks anyway
from aenetmail.
but be aware that message-id is not a mandatory header field.
the only unique id of a message is the UID together with the UIDVALIDITY of a mailbox.
As RFC3501 specifies (http://tools.ietf.org/html/rfc3501#page-8)
no UID will change during sessions. And no UID will ever be used by an IMAP server again.
The thing is that only server side knows the UID. So there is no header property which contains the UID.
from aenetmail.
Ok, then how should I know if a message from the server is already saved in my local email database ?
from aenetmail.
It's quite easy, you must cache locally all UID's which was synced so far.
Please also refer to this informational paper regarding synchronisation between IMAP server and client.
For me it was very helpful:
http://tools.ietf.org/html/rfc4549
best regards
from aenetmail.
I'm sorry but I don't get it.
That's what I was doing but what I understood from Andy's remarks and yours is that according to the rfc, the UID of a message is not necessarily the same between two sessions...
from aenetmail.
rfc specifies that the UID MUST NOT change during a session and SHOULD NOT change between sessions.
I figured out that gmail for example doesn't change UIDs between the sessions.
If you gonna use your client as gmail only for example you can also refer to Google's unique msg-id:
http://code.google.com/apis/gmail/imap/#x-gm-msgid
from aenetmail.
That's what I'm saying, but the thing is I don't know which email provider my users will use.
Therefor, I was looking for a way to permanently identify each message.
But if the uid is not always unique and if the message-id is not mandatory... I guess the only 100% valid way is to compare the headers (and yet, the server may contain identical messages), which seems like a very slow method...
from aenetmail.
Ok. Now I got you. I was excactly faced to the same issue.
But I belive that in common the UID will not be changed by the different IMAP providers.
That would be a big pitfall for every IMAP client implementation....
from aenetmail.
Hmm... I guess that leaves me with one option : hoping that every imap server used respects the unique uid...
from aenetmail.
You could rely on the message-ID header and when it's not present, generate it and store it on the server.
On Jan 16, 2012, at 5:41 AM, "piher" [email protected] wrote:
Hmm... I guess that leaves me with one option : hoping that every imap server used respects the unique uid...
Reply to this email directly or view it on GitHub:
#19 (comment)
from aenetmail.
I would not prefer the usage of message-Ids for identifying messages.
At least you can't use message-id for updating the message on the IMAP server eg. for marking or deleting.
even a FETCH command isn't possible with message-id.
from aenetmail.
Right, you would use UID for communications within a session to the server, but for determining whether a message exists in a local store, you'd have to use message-ID.
from aenetmail.
Related Issues (20)
- Unable to delete the message from Inbox HOT 1
- How to connect to other that gmail account? Example imap.company.com. HOT 1
- Label for 1.7.10.0? HOT 1
- System.Exception while moving mail on Gmail
- How to get unseen count HOT 1
- Difference between aenetmail and other IMAP libs?
- Error searching for Gmail emails started "xm003 BAD Could not parse command" HOT 6
- Getting "An existing connection was forcibly closed by the remote host" error HOT 1
- POP3 Client | Cant download anything HOT 1
- outlook.office365 connect problem
- Accessing shared mailboxes
- AE.Net.Mail.Attachment.Save() method exception
- Emails from yeah.net (possibly 163.com too) causes issues selecting "INBOX" HOT 2
- CRITICAL: Multi-part Mail at END of stream results in a CPU-Heavy INFINITE loop!
- SearchCondition 按照时间筛选没用不起效果! 什么情况
- Support Net 5
- xm001 NO [UNAVAILABLE]
- .net core: "No data is available for encoding 1252" HOT 1
- How should I credit your work? HOT 2
- Regarding updates
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 aenetmail.