Bayram
Bayram

Reputation: 1

How to get next greater existent message uid from remote mail server by using PHP IMAP functions?

In the beginning, suppose that there are 3 messages on the remote mail server. Uid 1, 2, 3 We download them by using PHP IMAP functions (namely POP3 connection). Mail server provides us with next uid, i.e. uid 4. And we save it.

Several days later, suppose that there are new messages on the remote mail server, some of them being deleted. Uid 1, 2, 3, 4(deleted), 5(deleted), 6(deleted), 7, 8, 9

So, actual situation will look like as such: Uid 1, 2, 3, 7, 8, 9 The question is: when we give uid 3 (or uid 4), we want to get next greater existent uid, i.e. uid 7.

To put in a more general way: Uid = {1, 2, 3, 7, 8, 9, 12, 13}

f(2) = 3  [give uid 2, and get uid 3]
f(3) = 7
f(4) = 7
f(8) = 9
f(9) = 12
f(10) = 12
f(13) = null or empty
f(17) = null or empty

When we have uid number, we can obtain message number, and download messages.

I am developping a mail client, and I am not able to get next uid.

Upvotes: 0

Views: 35

Answers (0)

Related Questions