Javax.mail.FolderNotFoundException: Sent Items not found
NickName:Meh Ask DateTime:2022-06-09T18:48:55

Javax.mail.FolderNotFoundException: Sent Items not found

Hello im trying to retreive emails sent by my outlook mail but i have a prob in the folder name I can retreive my mail inbox using the folder "Inbox" but i want the sent items folder

final String username = "[email protected]";  
    final String password = "XXXX";
        Properties props = new Properties();
props.setProperty("mail.store.protocol", "imaps");        
props.setProperty("mail.imap.port", "993");
props.setProperty("mail.imap.connectiontimeout", "5000");
props.setProperty("mail.imap.timeout", "5000");

        Session session = Session.getDefaultInstance(props, null);
        session.setDebug(true);
        try {
            Store store = session.getStore("imaps");
            store.connect("outlook.office365.com", username, password);
            

            Folder inbox = store.getFolder("Sent Items");
            inbox.open(Folder.READ_ONLY);
            Message[] messages = inbox.getMessages();
            for (int i = 0; i < messages.length; i++) {
                Message message = messages[i];
                System.out.println("---------------------------------");
                System.out.println("Email Number " + (i + 1));
                System.out.println("Subject: " + message.getSubject());
                System.out.println("To: " + message.getRecipients(Message.RecipientType.TO));
                System.out.println("Text: " + message.getContent().toString());
            }
            inbox.close(true);
            store.close();
        } catch (Exception e){
   e.printStackTrace();
  }
avax.mail.FolderNotFoundException: Sent Items not found
    at com.sun.mail.imap.IMAPFolder.checkExists(IMAPFolder.java:455)
    at com.sun.mail.imap.IMAPFolder.open(IMAPFolder.java:1068)
    at com.sun.mail.imap.IMAPFolder.open(IMAPFolder.java:1001)
    at com.jsf.com.SendEmail.read2(SendEmail.java:61)
    at com.jsf.com.SendEmail.main(SendEmail.java:11)

Copyright Notice:Content Author:「Meh」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/72558973/javax-mail-foldernotfoundexception-sent-items-not-found

More about “Javax.mail.FolderNotFoundException: Sent Items not found” related questions

Javax.mail.FolderNotFoundException: Sent Items not found

Hello im trying to retreive emails sent by my outlook mail but i have a prob in the folder name I can retreive my mail inbox using the folder &quot;Inbox&quot; but i want the sent items folder final

Show Detail

ErrorItemNotFound for Sent Items message notification

We have created a subscription for all mailbox folders as users/[email protected]/messages?$filter=isDraft eq false When creating a subscription the Prefer header is specified: IdType = &quot;

Show Detail

move mailitem to sent items

When responding to emails on a website, I receive a copy of my replies back to my inbox. I am creating code that will update my Outlook inbox and show the original inquiry as being replied to, and...

Show Detail

Get Sent Date from Sent Items - VSTO - Outlook

I need to get the &quot;Sent Date&quot; from the Sent Items e-mails, but I am following the example from Microsoft's documentation, for the implementation, making changes to get it from the sent it...

Show Detail

How to have a copy of sent email on sent items folder

I send emails with Indy 10 components on Delphi XE6. It work fine but I would like to have an copy of email on my sent items box. On SMTP server, like Gmail it work automaticly, but on MS Exchange ...

Show Detail

mail sent from google-app-engine app not appearing on my "sent items" on gmail account

I have an application hosted on google app engine that sends mail to people under certain conditions. The mail is sent on my behalf. Earlier, each time a mail was sent, I would find the sent mail o...

Show Detail

Run rules on the Sent Items folder

I have rules in Outlook for incoming and posted emails. I found in the web the following routine which works for the emails which are in the 'INBOX'. I am not able to use the GetRootFolder to selec...

Show Detail

In outlook 2010 how to send multiple emails as reply all from sent items?

i am not a techie, am florist Need help in finding on how to reply all in outlook 2010 from sent items (multiple emails) In outlook 2010, i want to follow up the emails i sent from sent folder ...

Show Detail

Items.restrict method to look for items that are sent today

I'm trying to write a code to download weekly assignments (attachments) and save it to a folder. I got a code which goes through every item and downloads all the attachments but it goes from late...

Show Detail

Query to fetch sent items in a conversation

Currently i am using a below query which returns all mail items in a conversation which i feel pretty inefficient where i only require sent folder items. How to modify filter query to return items ...

Show Detail