Solved

JavaMail delete message on server

Posted on 2001-08-22
3
1,686 Views
Last Modified: 2013-11-24
HI

I am trying to delete a message, first by setting the

messages[i].setFlag(Flags.Flag.DELETED, true);


then use folder.expunge();


But my pop3 server doe snot support this method.


Is there a method to delete a message on a mail server after reading it,  using JavaMail API??
0
Comment
Question by:TLTEO
  • 2
3 Comments
 
LVL 2

Expert Comment

by:ia_ia_ia_1
ID: 6416874
I think u should close the folder using folder.close(true) - the flag indicating u would like to reflect the deletion on the server
0
 
LVL 2

Accepted Solution

by:
ia_ia_ia_1 earned 20 total points
ID: 6416884
This is what could be read in a Sun's tutorial:
"There is an expunge() method of Folder that can be used to delete the messages. However, it doesn't work for Sun's POP3 provider. Other providers may or may not implement the capabilities. It will more than likely be implemented for IMAP providers. Because POP only supports single access to the mailbox, you have to close the folder to delete the messages with Sun's provider"

http://developer.java.sun.com/developer/onlineTraining/JavaMail/contents.html#JavaMailDeleting
0
 

Author Comment

by:TLTEO
ID: 6418434
tks  so simple and so good. apprec it. cheers
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now