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.
You can download (or maybe upload) emails in various ways when using different email providers. My experience with the following providers is:
-
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.
-
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).
-
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.
-
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.
-
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.
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