By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,016 Members | 2,255 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,016 IT Pros & Developers. It's quick & easy.

Pop3 java application errors: import javax.mail.internet

P: 45
I want to implement POP3 program in java....I have written the code like...

import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;

public class POP3Client {

public static void main(String[] args) {

Properties props = new Properties();

String host = "";
String username = "eharold";
String password = "mypassword";
String provider = "pop3";

try {

// Connect to the POP3 server
Session session = Session.getDefaultInstance(props, null);
Store store = session.getStore(provider);
store.connect(host, username, password);

// Open the folder
Folder inbox = store.getFolder("INBOX");
if (inbox == null) {
System.out.println("No INBOX");

// Get the messages from the server
Message[] messages = inbox.getMessages();
for (int i = 0; i < messages.length; i++) {
System.out.println("------------ Message " + (i+1)
+ " ------------");

// Close the connection
// but don't remove the messages from the server

catch (Exception ex) {

But i am getting some import javax.mail.internet.*.....
So i want the help on how to import that package.....and kindly give me some tips and requirements to implement this program....
Jul 29 '09 #1
Share this Question
Share on Google+
3 Replies

Expert 10K+
P: 11,448
You have to download the Java Mail API from Sun; you can do that here. Put the jar on your classpath and compile and run your program.

kind regards,

Jul 29 '09 #2

P: 45
I have downloaded Java Mail-1.4.2....It contains several folders and one file there as mail(executable jar file).....Still I have the doubt on where i have to put which file.....
.......Kindly repl me anyone...
Aug 18 '09 #3

Expert 10K+
P: 11,448
Were there no installation instructions? I doubt that but nevermind, reading seems to be an extinct form of art. Put the jar in your jre/lib/ext directoy, it'll always be found there.

kind regards.

Aug 18 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.