473,396 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Pop3 java application errors: import javax.mail.internet

sreekandank
I want to implement POP3 program in java....I have written the code like...

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

public class POP3Client {

public static void main(String[] args) {

Properties props = new Properties();

String host = "utopia.poly.edu";
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");
System.exit(1);
}
inbox.open(Folder.READ_ONLY);

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

// Close the connection
// but don't remove the messages from the server
inbox.close(false);
store.close();

}
catch (Exception ex) {
ex.printStackTrace();
}
}
}

But i am getting some errors....like 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
3 2899
JosAH
11,448 Expert 8TB
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,

Jos
Jul 29 '09 #2
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
JosAH
11,448 Expert 8TB
@sreekandank
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.

Jos
Aug 18 '09 #4

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

Similar topics

0
by: Ravi Tallury | last post by:
Hi We are having issues with our application, certain portions of it stop responding while the rest of the application is fine. I am attaching the Java Core dump. If someone can let me know what...
9
by: CY FOK | last post by:
Hi I am planning to open a software company to develop client-server apps and web applications for my client. Now, i am in a difficult situation to determine what is the best platform i should use...
4
by: acemann7 | last post by:
Windows 2000 udb v 7.2 Got the latest fixpak 13 Applied it. Still can't get a single java sp to run. I used to get reason "2"... now reason "0" - reason 0 is not even documented. I point...
0
by: muralidharan | last post by:
WebForm1.aspx Code: <%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %> <ComponentArt:TreeView id="TreeView1" Height="520"...
0
by: subramanian100in | last post by:
I have given below the structures and the function that finds the height of a BST by iteration. I have tested the function for several input sets and it is working. Kindly review the code and...
2
by: vijayrvs | last post by:
SearchCrawler.java The program search crawler used to search the files from the website. From the following program i got 7 compiler error. can any body clarify it and provide me solution. ...
7
by: swethak | last post by:
Hi, i have a command to convert the video file into image ffmpeg -i sample.wmv -f image2 -t 0.001 -ss 3 ss.jpg i run that one in command prompt it converted the video file into...
1
by: cmrhema | last post by:
Hi, I wrote the following code in the page load event string path = clientServerXRef1.GetDownloadpath(company.ToUpper()); System.IO.FileStream fs = null; fs =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.