Giter Site home page Giter Site logo

Comments (15)

andyedinborough avatar andyedinborough commented on August 15, 2024

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.

piher avatar piher commented on August 15, 2024

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.

andyedinborough avatar andyedinborough commented on August 15, 2024

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.

piher avatar piher commented on August 15, 2024

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.

jigga-j avatar jigga-j commented on August 15, 2024

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.

piher avatar piher commented on August 15, 2024

Ok, then how should I know if a message from the server is already saved in my local email database ?

from aenetmail.

jigga-j avatar jigga-j commented on August 15, 2024

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.

piher avatar piher commented on August 15, 2024

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.

jigga-j avatar jigga-j commented on August 15, 2024

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.

piher avatar piher commented on August 15, 2024

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.

jigga-j avatar jigga-j commented on August 15, 2024

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.

piher avatar piher commented on August 15, 2024

Hmm... I guess that leaves me with one option : hoping that every imap server used respects the unique uid...

from aenetmail.

andyedinborough avatar andyedinborough commented on August 15, 2024

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.

jigga-j avatar jigga-j commented on August 15, 2024

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.

andyedinborough avatar andyedinborough commented on August 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.