0

We need to build a client for Hotmail, which doesn't support IMAP. To my understanding you have to use exchange w/ POP3 but POP3 doesn't support moving mail from one folder to another. We need the features:

  • be able to read mail without marking it as "read"
  • be able to delete mail
  • be able to move mail out of inbox to another folder and mark as read

Any way to get this to work?

djechlin
  • 59,258
  • 35
  • 162
  • 290

3 Answers3

0

Short answer, No.

License the ActiveSync protocol from Microsoft.

There is an Outlook connector for Hotmail. Maybe with a ton of JNI but check the license first.

Chase
  • 3,123
  • 1
  • 30
  • 35
0

Update: Outlook now supports IMAP. Hotmail uses the same servers.

djechlin
  • 59,258
  • 35
  • 162
  • 290
-1

You can do everything you need with JavaMail. Here is the API

Here is an example of getting all unread messages from an inbox and marking them as read. Take a look at the folder class (specifically the copyMessages() method) to move messages to a new folder.

import java.util.Properties;
import javax.mail.*;
import javax.mail.search.FlagTerm;

public class Driver {
    public static void main(String[] args){

        // Create properties (disable security checks on server)
        Properties props = new Properties();

        // Get session
        Session session = Session.getDefaultInstance(props, null);

        try{
            // Get the store
            Store store = session.getStore("pop3");
            store.connect("servername", "username", "password");

            //connection configuration
            Folder folder = store.getFolder("INBOX");
            folder.open(Folder.READ_WRITE);

            //get all unread messages in the inbox
            FlagTerm ft = new FlagTerm(new Flags(Flags.Flag.SEEN), true); 
            Message[] messages = folder.search(ft);

            for (int i = messages.length -1; i>=0; i--) {
                    messages[i].setFlag(Flags.Flag.SEEN, true);
                }

            // Close connection 
            folder.close(false);
            store.close();
        }
        catch(Exception e){
                  e.printStackTrace();
        }
    }
namenamename
  • 195
  • 7