Package javax.mail

Examples of javax.mail.Folder.open()


  {
    List<OutboundMessage> retValue = new ArrayList<OutboundMessage>();
    Store s = this.mailSession.getStore();
    s.connect();
    Folder inbox = s.getFolder(getProperty("mailbox_name", "INBOX"));
    inbox.open(Folder.READ_WRITE);
    for (Message m : inbox.getMessages())
    {
      OutboundMessage om = new OutboundMessage(m.getSubject(), m.getContent().toString());
      om.setFrom(m.getFrom().toString());
      om.setDate(m.getReceivedDate());
View Full Code Here


  public String compact() throws MessagingException
  {
    Folder folder = _folderData.getFolder();
   
    folder.open(Folder.READ_WRITE);
    // It would be much more efficient to simply trim out
    // the list of "expunged" messages from the data model;
    // instead, we're refreshing the list.
    folder.expunge();
    folder.close(true);
View Full Code Here

      {
        // Save the old row key
        Object oldRowKey = _messagesTable.getRowKey();

        Folder folder = _folderData.getFolder();
        folder.open(Folder.READ_WRITE);
        List<Message> messageList = new ArrayList<Message>();
        try
        {
          while (selection.hasNext())
          {
View Full Code Here

            st.connect(this.host, this.user, this.pass);

            log("Attempting to open default folder");
            Folder f = st.getFolder("inbox");

            f.open(Folder.READ_WRITE);

            log("Downloading message list from folder");
            this.message = f.getMessages();

            int i = 0;
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

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

    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

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.