tags:

views:

683

answers:

4

I am doing an Android application and I want to get the last 25 sent mails from a certain email account.

For Gmail I might use http://g4j.sourceforge.net/ and there is Mail Web Service API for Yahoo at http://developer.yahoo.com/mail/.

But I couldn't find something to do it with Hotmail.

Do you know if it is possible?

Also I am worried of having so many dependencies. I don't know if I should do something like https://sourceforge.net/projects/mrpostman/ and do web scraping.

A: 

Why don't you just use either the built-in email facilities or standard access methods over IMAP? I guess using a separate lib for every provider won't work well in practice.

moritz
are you sure I can access sent items on every provider using IMAP?
Macarse
No, that's for you to find out! ;)But using standardised protocols are certainly the way to go, rather than using some potentially fragile library for each provider.
Christopher
Actually only gmail offers IMAP access, so this will not work :(
Macarse
get it via POP and leave the messages on the server. But wait! I dont know if POP-providers do maintain a sent-messages box..
moritz
nope. You can't get sent msgs with pop :(
Macarse
Also, Gmail's POP service doesn't let you leave messages on the server; it removes them from the POP inbox on read.
me_and
To access emails sent from every possible client IMAP is the way to go.
dtmilano
+1  A: 

In our company's webapp, we use JavaMail to send mail through gmail account (very easy to use and powerful API). On JavaMail third-party product page I found project JDAVMail. It provides access method for WebDAV based protocol services. Maybe it'll be useful for you.

And, for Android: javamail-android

Yuri.Bulkin
Thanks, but JDAVMail will only solve hotmail.
Macarse
+5  A: 

You can download (or maybe upload) emails in various ways when using different email providers. My experience with the following providers is:

  1. Yahoo:

    • POP3: Only available for Plus users (paid service). No get new messages, no folder access, no sent mail; just fetch all inbox (or all email UIDs). UPDATE: Yahoo provides free POP access and forwarding for Yahoo Asia users.
    • Mail Web Service API: Only listing email headers for Free users but complete access, including fetch mail from sent folder, for Plus users (paid service again). Of course, you are paid a commission by Yahoo if you can encourage (force) users to buy the Plus service if you are not sued before that by Yahoo lawyers because it is stated in the Web Service documentation that: "You may not use the Yahoo! Mail Web Service API to display the user's Yahoo! account information in a third party email client".
    • Web Scraping: It seems the only available solution for Free users of Yahoo but be aware of the compatibility problems that may arise when Yahoo changes its web pages. Also make sure to delay link accesses because Yahoo has web scraping detection mechanism on its servers.
  2. GMail:

    • IMAPv4: Available for all users. Make sure to use this protocol for accessing almost everything in GMail. It is implemented completely; you can access all incoming and sent mails and even send an email by saving it in the sent folder. You can use JavaMail or any other IMAP client library in Java such as Ristretto API to do this. Make sure to know the JavaMail limitations before starting to use it for any protocol. It has many limitations (and minor bugs) in all protocols (SMTP/POP3/IMAP).
    • POP3: Available for all users of GMail but not recommended because of POP3 inherent limitations (no folder, no get new messages).
  3. Hotmail:

    • POP3: Available for all users but again POP3 inherent limitations (no folder, no sent mail, no get new messages) in addition to Hotmail limitation called 15-minutes-delay-necessary for POP3 access.
    • Web Scraping: It seems the only solution for accessing sent mail but again be aware of the compatibility problems that may arise when Microsoft changes Hotmail web pages and web scraping detection software which may exist.
  4. General IMAPv4 Provider:

    • In general, not all IMAP providers support sent folder because it is not a standard IMAP folder but most of them do this. Take a look at the provider's Help or FAQ for this option.
  5. Genral POP3 Provider:

    • Do not expect POP3 to do this because POP3 does its best not to crash both the client and server when fetching 2 new emails from inbox ;-)

Meanwhile, do not forget that Web Scraping has legal issues and is forbidden in most web sites.

Amir Moghimi
Thanks for the info. It's actually a summary of what I've research but this don't answer how to fetch mails in the sent folder of those three providers.
Macarse
To be straight enough: Use web scraping for Yahoo and Hotmail (use MrPostman if it still works) and work with IMAP using JavaMail (or Ristretto API) for GMail :)
Amir Moghimi
Or maybe: You can't do that properly except for GMail, where you can use IMAP.
svens
A: 

Google has its Mail application as open source.

http://android.git.kernel.org/?p=platform/packages/apps/Email.git;a=summary

You might be able to utilize some of the source code yourself.

Jeremy Edwards
This is not an issue.
Macarse