• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Trying to copy messages from Inbox to some custom folder in outlook.

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Trying to copy messages from Inbox to some custom (say 'DestinationFolderName') folder in outlook.

This is the code snippet:

Folder inbox = store.getFolder("Inbox");
inbox.copyMessages(msgs, <DestinationFolderName>);

I created destination folder manually. I have the complete code but in the above line while trying to copy the messages from Inbox to the <DestinationFolderName> getting the below error though the destination folder exists. I'm using pop3 protocol and javax.mail.*

javax.mail.FolderNotFoundException: <DestinationFolderName> does not exist
at javax.mail.Folder.copyMessages(Folder.java:1132)
 
Marshal
Posts: 28176
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mohamed Shafi Shamsuddin wrote:I'm using pop3 protocol...



... and POP3 doesn't have the concept of "folders". If you want to work with folders then you can't use POP3. Try IMAP instead.
 
Paul Clapham
Marshal
Posts: 28176
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And welcome to the Ranch!
 
Mohamed Shafi Shamsuddin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much Paul. It worked when I used IMAP protocol.
 
Mohamed Shafi Shamsuddin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Paul Clapham,
Now I can COPY messages from Inbox to any custom folder using IMAP.
Do you know whether I can MOVE messages from Inbox to any custom folder??? (Message should get deleted from Inbox folder).

 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried deleting the originals after copying them?
 
Mohamed Shafi Shamsuddin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is one method available to delete but that did not work for me.

inbox.expunge(); // This did not work and messages was not deleted.

abstract Message[] expunge() (Expunge (permanently remove) messages marked DELETED.)

Thanks for your help Rob.
 
Rob Spoor
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you mark the message as deleted first?
 
Mohamed Shafi Shamsuddin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Rob. I set the flag and the messages got deleted now.
 
Rob Spoor
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic