Package javax.mail

Examples of javax.mail.Folder.open()


    store.connect("imap.gmail.com", username, password);

    // Retrieve the "Inbox"
    Folder inbox = store.getFolder("inbox");
    // Reading the Email Index in Read / Write Mode
    inbox.open(Folder.READ_WRITE);

    FlagTerm ft = new FlagTerm(new Flags(Flags.Flag.SEEN), false);
    Message messages[] = inbox.search(ft);
    // Message messages[] = inbox.getMessages();
    int count = 0;
View Full Code Here


    {
      ArrayList<Resource> resources = new ArrayList<Resource>(limit);

      FlagTerm ft = new FlagTerm(new Flags(Flags.Flag.SEEN), false);
      Folder inbox = store.getFolder("Inbox");
      inbox.open(Folder.READ_ONLY);
      Message messages[] = inbox.search(ft);

      for(int i = 0; i < messages.length && resources.size() < limit; i++)
      {
        Message msg = messages[i];
View Full Code Here

    store.connect("imap.gmail.com", gmail, password);

    // Retrieve the "Inbox"
    Folder inbox = store.getFolder("inbox");
    // Reading the Email Index in Read / Write Mode
    inbox.open(Folder.READ_WRITE);
    FlagTerm ft = new FlagTerm(new Flags(Flags.Flag.SEEN), false);
    Message messages[] = inbox.search(ft);
    System.out.println(messages.length + " unread message");

    // Loop over all of the messages
View Full Code Here

        Store store = session.getStore("pop3");
        store.connect(pop3Host, pop3Port, mailAddress, mailPassword);

        Folder inbox = store.getFolder("INBOX");
        assertNotNull(inbox);
        inbox.open(Folder.READ_WRITE);

        Message[] messages = inbox.getMessages();
        for (int i = 0; i < messages.length; i++) {
            if (sender.equals(messages[i].getFrom()[0].toString()) && subject.equals(messages[i].getSubject())) {
                found = true;
View Full Code Here

    try {
      // Retrieve the "Inbox"
      Folder inbox = store.getFolder("inbox");
      // Reading the Email Index in Read / Write Mode
      inbox.open(Folder.READ_WRITE);
      FlagTerm ft = new FlagTerm(new Flags(Flags.Flag.SEEN), false);
      Message messages[] = inbox.search(ft);

      // Loop over all of the messages
      for (int i = messages.length - 1; i >= 0; i--) {
View Full Code Here

    store.connect("imap.gmail.com", gmail, password);

    // Retrieve the "Inbox"
    Folder inbox = store.getFolder("inbox");
    // Reading the Email Index in Read / Write Mode
    inbox.open(Folder.READ_WRITE);
    FlagTerm ft = new FlagTerm(new Flags(Flags.Flag.SEEN), false);
    Message messages[] = inbox.search(ft);

    // Loop over all of the messages
    for (int i = messages.length - 1; i >= 0; i--) {
View Full Code Here

    store.connect("imap.gmail.com", username, password);

    // Retrieve the "Inbox"
    Folder inbox = store.getFolder("inbox");
    // Reading the Email Index in Read / Write Mode
    inbox.open(Folder.READ_WRITE);

    FlagTerm ft = new FlagTerm(new Flags(Flags.Flag.SEEN), false);
    Message messages[] = inbox.search(ft);
    // Message messages[] = inbox.getMessages();
View Full Code Here

    store.connect("imap.gmail.com", username, password);

    // Retrieve the "Inbox"
    Folder inbox = store.getFolder("inbox");
    // Reading the Email Index in Read / Write Mode
    inbox.open(Folder.READ_WRITE);

    FlagTerm ft = new FlagTerm(new Flags(Flags.Flag.SEEN), false);
    Message messages[] = inbox.search(ft);
    // Message messages[] = inbox.getMessages();
    int count = 0;
View Full Code Here

            store.connect(getServer(), getPortAsInt(), getUserName(), getPassword());

            // Get folder
            Folder folder = store.getFolder(getFolder());
            if (deleteMessages) {
                folder.open(Folder.READ_WRITE);
            } else {
                folder.open(Folder.READ_ONLY);
            }

            // Get directory
View Full Code Here

            // Get folder
            Folder folder = store.getFolder(getFolder());
            if (deleteMessages) {
                folder.open(Folder.READ_WRITE);
            } else {
                folder.open(Folder.READ_ONLY);
            }

            // Get directory
            Message messages[] = folder.getMessages();
            StringBuilder pdata = new StringBuilder();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.