Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java Mail

843830Jun 23 2002 — edited Jun 25 2002
Hello,

I encountered with problem while connectingto INBOX using java mail. I could not find the solution for this.

Any solutions to this problem please.

Thnaks
Sudhakar

Error Message
C:\mail>java NewMail
Exception in thread "main" javax.mail.NoSuchProviderException: No provider for pop3
at javax.mail.Session.getProvider(Session.java:249)
at javax.mail.Session.getStore(Session.java:323)
at javax.mail.Session.getStore(Session.java:303)
at NewMail.main(NewMail.java:17)

Source code is

import javax.mail.*;
import javax.mail.internet.*;

public class NewMail {
public static void main (String args[])
throws Exception {
//,"smtp.freeserve.net"
String host = "pop.freeserve.net";
String username = "xxx@konda.freeserve.co.uk";
String password = "xxx";

// Get session
Session session = Session.getInstance(
System.getProperties(), null);

// Get the store
Store store = session.getStore("pop3");
store.connect(host, username, password);

// Get folder
Folder folder = store.getFolder("INBOX");
folder.open(Folder.READ_ONLY);

// Get Count
int count = folder.getMessageCount();
System.out.println("Messages waiting: "
+ count);
count = folder.getUnreadMessageCount();
System.out.println("Unread messages waiting: "
+ count);

// Close connection
folder.close(false);
store.close();
}
}


Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 23 2002
Added on Jun 23 2002
1 comment
172 views