November 21, 2008 at 12:43 AM
Hi friend,
Code to help in solving the problem :
import java.io.*;
import java.util.*;
import javax.mail.*;
public class ReadMail {
public static void main(String args[]) throws Exception {
String host = "192.168.10.205";
String user = "test";
String password = "test";
// Get system properties
Properties properties = System.getProperties();
// Get the default Session object.
Session session = Session.getDefaultInstance(properties);
// Get a Store object that implements the specified protocol.
Store store = session.getStore("pop3");
//Connect to the current host using the specified username and password.
store.connect(host, user, password);
//Create a Folder object corresponding to the given name.
Folder folder = store.getFolder("inbox");
// Open the Folder.
folder.open(Folder.READ_ONLY);
Message[] message = folder.getMessages();
// Display message.
for (int i = 0; i < message.length; i++) {
System.out.println("------------ Message " + (i + 1) + " ------------");
System.out.println("SentDate : " + message[i].getSentDate());
System.out.println("From : " + message[i].getFrom()[0]);
System.out.println("Subject : " + message[i].getSubject());
System.out.print("Message : ");
InputStream stream = message[i].getInputStream();
while (stream.available() != 0) {
System.out.print((char) stream.read());
}
System.out.println();
}
folder.close(true);
store.close();
}
}
For more information on Java visit to :
http://www.roseindia.net/javamail/Thanks
Related Tutorials/Questions & Answers:
to retrive e mails as per user name - Java Beginnersto
retrive e
mails as per
user name hi friends,
how to
retrive e
mails as per
user "
user name "
for ex:
class Mail{
private String subject... to
retrive all
mails for
user "userName"
//and return a set of mail objects
Advertisements
retrive mails - Java Beginnersretrive mails hi
how to
retrive mails using mysql in
java not
using pop3 or imap
directly
from database
i am
using dbfile system in james server.header should be store in database and message in file system
thanks
bala
Request URl using Retrive data from dtabaseRequest URl
using Retrive data
from dtabase
Using With GWT
the
user..., preview and save and post buttons. Once the
user entered all the datas and if he... the contents
from the db based on the event id. But this jsp url should
retrive data from database using jsp in struts? retrive data
from database
using jsp in struts? *search.jsp*
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<... searchProduct(SearchDTO sdto) {
String query="select *
from product
url parameter using retrive data from database in jspurl parameter
using retrive data
from database in jsp the
user can..., preview and save and post buttons. Once the
user entered all the datas and if he... the contents
from the db based on the event id. But this jsp url should be a public
url parameter using retrive data from database in jspurl parameter
using retrive data
from database in jsp The
user can..., preview and save and post buttons. Once the
user entered all the datas and if he... the contents
from the db based on the event id. But this jsp url should be a public url
java [ cannot retrive date from sql ] why??java [ cannot
retrive date
from sql ] why??
import...=st.executeQuery("select amt
from add where dte= "+sdf.format(da)+" "); // why cannot I
retrive data
from bd even if I put correct data in it
if( rs.next
Read user input in Java using ScannerExample of of reading
user input in
Java using Scanner
In this section we are explaining the use of Scanner class in
Java which can
be used to read
user input
from console. Our sample program asks
user to enter
name and then age,
user How to hide HTML code from user? - SecurityHow to hide HTML
code from user? Hi All,
I am trying to provide security to my web application.
To achieve this I want to restrict
user from... showing source
code is by generating the elements on the page
using javascript
retrive data from database?retrive data
from database? hellow
i have a database sheet name..... now i want
retrive sn,roll no and name and textbox
like....,rllno,and name
retrive Insert image from user using and save in databaseInsert image
from user using and save in database when i am trying to upload a image
from user and trying to save into oracle9i database...
description The server encountered an internal error () that prevented it
from retrive data from database retrive data
from database hi..
i made a application form. it's have attribute s.no,name,roll no and i enter a few records. now i want to view all record not in database access sheet i want to view it at any another
store and retrive image from the databasestore and
retrive image
from the database please provide me... to store and retreive images
from sql database
using sql commands
-how to store and retreive images
from sql database
using asp.net/c#
thanks in advance
GWT -- retrive the data from DatabaseGWT --
retrive the data
from Database the
user can create an event... and post buttons. Once the
user entered all the datas and if he clicks the Preview button, you have to create a dynamic jsp which should read the contents
from why mails are sending from the linux server - JavaMailwhy
mails are sending
from the linux server
Mails are not sending
from the linux server.We have 3 systems. server system is windows 2003 server and Our
java application is inside linux server. Whenever we send the
mails from retrive data from oracle to jspretrive data
from oracle to jsp i am a beginer in jsp so please help... if
user enters any one of the feild such as id name cost and manager the full details...();
psmt= conn.prepareStatement("select *
from CR_EMPLOYEE_DETAILS
To retrive data from database - StrutsTo
retrive data
from database How to get values ,when i select a select box in jsp and has to get values in textbox automatically
from database?
eg... come to jsp page automatically
from database
java code using swingsjava code using swings
code that should be able to enter data of student details
using all swings into the access database
using jdbc connectivity
store and retrive image from database - JDBCstore and
retrive image
from database how to store and
retrive an image in database
using java? Hi friend,
Code for store image in database
using Java.
import java.sql.*;
import java.io.*;
public class