Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
wrong identifier used in imap call #2789
I might be wrong, but I think this looks like a bug.
More explanation here:
The imap-protocol have 2 different identifiers
If emails are deleted from the mail box those will differ.
If I for example have had 100 mails to my mail box in total, but have deleted 90 of them
so, to get the last email I would according to the spec:
but that doesn't work in cURL. In cURL I do instead get the last email with:
This seams wrong, and according to this part of the specification the URL should be converted to
SO, this would fix it, but would break applications relying on todays behavior
For example the example in the bottom of this link will break:
since the correct behavior don't expect all UID to be present (not the deleted) But at the other hand the UID will be persistent.
Ah, I have missed this thread discussing this several years ago. I thought I had googled enough.
The thread says that todays behavior is ok in the standard. I have some problems seeing that (will have to read and reread some more).
But I absolutely agree with the need of backward compability.
Well, since we can't really do both ways by default we just have to decide which way is default and then offer an option that provides the old way/new way. I'd say it would probably be a good idea to do the existing (old) way only if a specific option is set.
Then we can probably at the same time bring up a discussion about deprecating this new option if we truly deem the new way to be the "one true way" of how things are done IMAP wise.
Added a pull request for the discussion.
It is a suggestion how to handle it.
In addition to UID= I added MAILINDEX=
I don't know if "MAILINDEX" is a good word, but as far as I have seen there is no wording for this in the spec.
So, with the patch UID= will get the mail with the requested UID
The difference is showing when mails are deleted in the mail box.
If we have received in total 2 mails in the mail box and the first is deleted:
At the other hand UID=2 will give the same mail both before and after deleting the first mail.
... and add "MAILINDEX". As described in curl#2789, this is a suggested solution. Changing UID=xx to actually get mail with UID xx and add "MAILINDEX" to get a mail with a special index in the mail box (old behavior). So MAILINDEX=1 gives the first non deleted mail in the mail box. Fixes curl#2789 Closes curl#2815