POP3: Download latest emails

SajoSG

New Email
I wish to know if it is possible to download only the latest emails (say last 3days emails only) using a POP3 client. (IMAP4 allows this)

Standard does not provide any such feasiblity but there are clients coming up which support this feature (or it seems so..). How is this possible???
Any foolproof method to support this feature..?? or m i just bein misled ;)
 

EQ Admin

EQ Forum Admin
Staff member
Hello,

Which pop3 email program are you using that lets you say "Download unread email from the last 3 days?"

I'm aware of only downloading new email, and also the option to remove from the server after X days, but not the specific feature that you are mentioning.

If you let me know which mail program you are using I'll take a look and test it out for myself.

:thanks:
 

SajoSG

New Email
Hi Raymond,

Frankly, i have not come across such an email client. However, i have seen the email client on mobile phones (IPhone, Blackberry) which support the feature "Download X numbers of emails".

i am developing a POP3 client as a self learning project and i wish to extend this feature to "Download recent X days emails". This is possible on IMAP Client since it does have a command. (UID SINCE). i want to know if there is any way i could provide such a support on POP3..
One option could be download all headers and then sort based on date. Now we are provided with the email list for the specified dates. However, this could be a very slow operation and costly to end user too... Any other suggestion/tricks could be very much helpful.

Thankyou,
Sajo
 

SajoSG

New Email
i have found that Pocket PC windows mobile 6 Email client supports this feature. However, i am puzzled as to how this support is done for POP3 without actually browsing throu all the emails to identify if it is received within the specified dates
 

EQ Admin

EQ Forum Admin
Staff member
Hello,

I checked the pop3 RFCs for this feature. It does not exist. You should read it too :

RFC 1939 (rfc1939) - Post Office Protocol - Version 3

RFC 2449 (rfc2449) - POP3 Extension Mechanism

The most important bit of info related to your wanting to create this feature would be the following :

Future extensions to POP3 are in general discouraged, as POP3's
usefulness lies in its simplicity. POP3 is intended as a download-
and-delete protocol; mail access capabilities are available in IMAP
[IMAP4]. Extensions which provide support for additional mailboxes,
allow uploading of messages to the server, or which deviate from
POP's download-and-delete model are strongly discouraged and unlikely
to be permitted on the IETF standards track.
If you did create the feature in the pop3 you'd also need to create it in your mail client, and both would be non-standard.

-Raymond
 

EQ Admin

EQ Forum Admin
Staff member
If you leave the server alone, I suppose you could build the logic into your mail program to hide or automatically move the rest of the downloaded emails into another folder other than the inbox? You need to download all of the new email. Figuring out a way to do extra things with it without confusing users of your program I think would be the greatest challenge. If they say only download the email from the last 5 days, and there is 7 days of new email, what would you do with days 6 and 7 after downloading them from the server?

-Raymond
 

EQ Admin

EQ Forum Admin
Staff member
How would you know how old the emails are?

Are you going to use the Date header or check the received headers?
 

SajoSG

New Email
The age of the email would be obtained from the Received: header. The most reliable solution would be to download all the emails' headers and then sort them based on date-time. On this sorted order, we could download and store those which fall within the specified date.

However, this solution has a performance overhead and is expensive to mobile users as the solution requires to download an email twice.:(

am not sure how does Windows phone support this feature for POP3 since the above solution seems to be the most apt one..Any clue:confused:

Thankyou
-Sajo
 

SajoSG

New Email
i think i have got one possible solution to the above problem.....
The POP3 RFC does say that the UID value of all the emails on the server is unique even across different session.

RFC1939:
The unique-id of a message is an arbitrary server-determined
string, consisting of one to 70 characters in the range 0x21
to 0x7E, which uniquely identifies a message within a
maildrop and which persists across sessions. This
persistence is required even if a session ends without
entering the UPDATE state. The server should never reuse an
unique-id in a given maildrop, for as long as the entity
using the unique-id exists.



Considering the above server compliance, the client would have to download all the headers the first time and then record the date-time of each email along with its UID to the device file system. Now the next time we wish to check emails for a specific date period, the information stored in the filesystem can be used to formulate the list of emails that fall within the date criteria and each of these can be downloaded.

However, in this solution too, the client would need to download the header one time atleast to get the date information... but it does provide the flexibility to the client not to download the header (to get date information) every time user attempts to download new emails......:)

Request suggestions to this methodology and pls let me know if there are better solutions....
 

EQ Admin

EQ Forum Admin
Staff member
Why would you ever need to download the emails twice?

You always only ever need to download the new email.

Once it's downloaded and processed you know the date.

The only problem I was wondering about is email that gets downloaded but is older than the only show me email from the last X days setting.

Would you put that in some other folder such as an "old email" folder ?

I wouldn't leave it on the server and keep scanning to see if you have them already.

Pop is not intended for leaving email on the server, unless of course this is still an educational experience limited to just your email account.

-Raymond
 

SajoSG

New Email
If this POP3 application is to used on a mobile phone, the File system constraint is also to be considered. Downloading older emails to the File System would eat up valuable EFS space which user may not so desire.

Considering the above limitation, we will not be able to store old email to the phone. Hence how do we know the date of the emails (old or new)??

We first download all headers and record the date information for each email to the database. Now sort the emails and download and save to the file system only those that are found for the specified period. On subsequent download operation, we can skip those emails which are already identified as old (info obtained from the database) and download only the available new emails on the server.

Well.. it is quite a task on the POP3 client application side but it does give a seamless IMAP like behaviour to the end user allowing him/her to get only the latest emails on the server...:)
 

abullion

New Email
If your client have to download all the headers the first time and then sort them via the date-time of each email. A lot of time will be consumed for thousands of mail for the first time.
 

SajoSG

New Email
Yep.. But it will be only at the first time when the client connects to the server.. subsequent operations will not be time consuming.. .
 
Top