POP3: Download latest emails

Discussion in 'Mail Server Support' started by SajoSG, Dec 2, 2009.

  1. SajoSG

    SajoSG New Email

    Joined:
    Dec 2, 2009
    Messages:
    8
    Likes Received:
    0
    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 ;)
     
  2. popowich

    popowich EQ Forum Admin Staff Member

    Joined:
    Aug 12, 2008
    Messages:
    7,934
    Likes Received:
    55
    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:
     

  3. SajoSG

    SajoSG New Email

    Joined:
    Dec 2, 2009
    Messages:
    8
    Likes Received:
    0
    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
     
  4. SajoSG

    SajoSG New Email

    Joined:
    Dec 2, 2009
    Messages:
    8
    Likes Received:
    0
    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
     
  5. popowich

    popowich EQ Forum Admin Staff Member

    Joined:
    Aug 12, 2008
    Messages:
    7,934
    Likes Received:
    55
    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 :

    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
     
  6. popowich

    popowich EQ Forum Admin Staff Member

    Joined:
    Aug 12, 2008
    Messages:
    7,934
    Likes Received:
    55
    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
     
  7. popowich

    popowich EQ Forum Admin Staff Member

    Joined:
    Aug 12, 2008
    Messages:
    7,934
    Likes Received:
    55
    How would you know how old the emails are?

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

    SajoSG New Email

    Joined:
    Dec 2, 2009
    Messages:
    8
    Likes Received:
    0
    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
     
  9. SajoSG

    SajoSG New Email

    Joined:
    Dec 2, 2009
    Messages:
    8
    Likes Received:
    0
    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:


    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....
     
  10. popowich

    popowich EQ Forum Admin Staff Member

    Joined:
    Aug 12, 2008
    Messages:
    7,934
    Likes Received:
    55
    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
     
  11. SajoSG

    SajoSG New Email

    Joined:
    Dec 2, 2009
    Messages:
    8
    Likes Received:
    0
    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...:)
     
  12. abullion

    abullion New Email

    Joined:
    May 5, 2010
    Messages:
    2
    Likes Received:
    0
    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.
     
  13. SajoSG

    SajoSG New Email

    Joined:
    Dec 2, 2009
    Messages:
    8
    Likes Received:
    0
    Yep.. But it will be only at the first time when the client connects to the server.. subsequent operations will not be time consuming.. .
     

Want to reply or ask your own question?

It only takes a minute to sign up (and it's free!). Click the orange sign up button to choose a username and then you can ask your own questions on the forum.
Loading...

Share This Page