Home Answers Viewqa Java-Beginners retrive mails from user using java code

 
 


bala
retrive mails from user using java code
1 Answer(s)      4 years and 6 months ago
Posted in : Java Beginners

View Answers

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 Pages:
retrive mails from user using java code - Java Beginners
retrive mails from user using java code   how to retrive mails as user "username"??? using java for ex: class Mail{ private String subject... to retrive all mails for user "userName" //and return a set of mail objects
retrive mails - Java Beginners
retrive 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
to retrive e mails as per user name - Java Beginners
to 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
automate mails in lotus notes
if the solution is in java also no problem Basically the user would just click some...automate mails in lotus notes  need some help with this question...we need to open up the Lotus Notes client from a JSP page.. Currently in the JSP
java source code to send group mails using struts2
java source code to send group mails using struts2  code to send group mails using struts2
store and retrive image from database - JDBC
store 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
url parameter using retrive data from database in jsp
url 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
Retrive data from databse to a text field - Java Server Faces Questions
Retrive data from databse to a text field  Hi, Can you give me a source code to rertrve data from Mysql databse to a text field using JSF.....by selecting option from a dropdown option
store and retrive image from the database
store 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
Request URl using Retrive data from dtabase
Request 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
GWT -- retrive the data from Database
GWT -- 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
image retrive into DataBase - JDBC
shows you how to retrieve image from database using a servlet and then show...image retrive into DataBase  Dear Deepak Sir, How to retrive..., Retrieving image from database is easy task. JDBC provides all the necessary API
retrive article from sql databse and show using php
retrive article from sql databse and show using php  hello sir... on web page using php. my field are image,title,summary,content id. plz provide me code only for show these content
unable to retrive the data from mysql using servlet using jdbc driver
unable to retrive the data from mysql using servlet using jdbc driver ... = stmt.executeQuery("SELECT * FROM login where username="+username+" and password...(request,response); } } .i am unable to redirect..here is the code..pls
url parameter using retrive data from database in jsp
url 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
jsp code for a drop down box to retrive value from database
jsp code for a drop down box to retrive value from database  my project needs to get the value from database in to the drop down box..... pls give me code for that ..... tan q   1)login.jsp: <html> <script>
retrive record from the text field and insert into to database
retrive record from the text field and insert into to database  the following code is inserting values in the my sql database but i want to insert... in the following code... import java.io.*; import java.sql.*; import javax.servlet.
How to set attachment from browse button to send mails using java mail api
How to set attachment from browse button to send mails using java mail api   Hello Sir, I am making Email Sending app using java mail api in jsp and servlet in that i have to make attachment option available using
sending mails - JSP-Servlet
sending mails  my intension is sending mails through java program with out installing any softwares.what is code
how to retrive
ArrayList(); String query = "select * from PRODUCT_LIST"; smp...; it's not working..ple anybody can correct is code
Copy Mails to Xl sheet - JavaMail
Copy Mails to Xl sheet  Can somebody give me the Java code to copy outlook mails into an Xl sheet
How to hide HTML code from user? - Security
How 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 image from database using jsp without stream
retrive image from database using jsp without stream  How to retrive image from database using jsp without stream like (inputStream
why mails are sending from the linux server - JavaMail
why 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 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
How to retrive an inmage from database and displaying it in imgae box - Swing AWT
How to retrive an inmage from database and displaying it in imgae box  hello Can you plz tell is there any imagebox related option in java swing? I want to retrive an image from database and to display it in a small imagebox
Retrive the data from the table in data base using jdbc
Retrive the data from the table in data base using jdbc  Retrive the data from the table in data base using jdbc   JDBC Tutorials
retrive data from oracle to jsp
retrive 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
retrive values - JSP-Servlet
retrive values  how to retrive multiple values from html to jsp  Hi Friend, Try the following code: 1)calljsp.html: Enter Name: Enter Address: Gender:MF Qualification: Btech MBA MCA MSC
facing problem while retrive value from Post textarea
facing problem while retrive value from Post textarea  Hi this is subha. I face a small problem while retriving value of the textbox in the java script.I use struts framework and this is my code for post textarea. <tr>
how to retrive the particular data from database in php with mysql?
how to retrive the particular data from database in php with mysql?  when am using mysqlfetcharray() that display the following error. the code look..._db("samp", $con); $Name=$_POST['unames']; $data=mysql_query("SELECT * FROM tbl
servlets mails - Java Beginners
servlets mails  Hi, My problem is " i want to send a one mail to many persons(i.e.,same mail to many persons) using servlets". Pls help me.  Hi Friend, Please visit the following links: http
Insert image from user using and save in database
Insert 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
Java get User Input
Java get User Input       In this section, you will learn how to get the user input from... prompt the user to enter the name by using System.out.print() method to keep
insert and retrive image from sql server database in jsp
insert and retrive image from sql server database in jsp  what is the code to insert and retrive an image from sql server database in jsp
how to convert image into bytes and also retrive the image from that bytes - Java Beginners
how to convert image into bytes and also retrive the image from that bytes  how to convert image into bytes and also retrive the image from that bytes?  Hi friend, Code to help in solving the problem : import
Java get User Home
Java get User Home       In this section, you will study how to get the user home. We are providing you an example which will obtain the home directory by using
Retrive values from an arraylist and display in a jsp?
Retrive values from an arraylist and display in a jsp?  Hi, I need help in jsp to display values of an ArrayList in jsp. There is a java file...") != null) { Open connection to the database; Read parameters from
Retrive values from an arraylist and display in a jsp?
Retrive values from an arraylist and display in a jsp?  Hi, I need help in jsp to display values of an ArrayList in jsp. There is a java file...") != null) { Open connection to the database; Read parameters from
How to retrive database information using servlet and disply in table format in browser
How to retrive database information using servlet and disply in table format in browser  Hi, any one send code how to retrive the data base information in table format in web browser
How to retrive a particular record from database in php with mysql?
How to retrive a particular record from database in php with mysql?  Am using phpMyAdmin Database.In mysql database having 10 records. The field names are username,password,email,firstname,lastname. But i want to retrive 3 rd
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
code
code   hi I need help in creating a java code that reminds user on a particular date about their festival. i have no clue of how to do it.. am looking forward to seek help from you
By dropdownlist retrive data from database and show in textbox in jsp.
By dropdownlist retrive data from database and show in textbox in jsp.  Hello Sir, I am doing project in jsp.I have to retrive data from database, when I select value from dropdownlist, and that data I want to show in textbox
retrive the data from access database to drop down list box in jsp
retrive the data from access database to drop down list box in jsp  hai, im new to jsp now im using the jsp along with access database.in table i load all the data's i need to retrive the data from database to dropdown list box
retrive data from data base and print it in every page until logout
retrive data from data base and print it in every page until logout  suppose that a user login your website through user name & password. now... the USER NAME through retriving from database.suppose from home page he go to next
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
Retrive Values
Retrive Values  I want to retrive the values between the td by the id using the javascript.So please help me... html form like this <TABLE...; </TABLE> And I want to retrive Cell 1,Cell 2,Cell 3
insert and retrive data and time - SQL
insert and retrive data and time  hello everybody . Is there any method in java so that we can insert current system time and then it can be retrieve that date and time from database ? ..........................  
Find Cylinder area By inputting value from user
Find Cylinder area By inputting value from user  Hello Sir I need the code for calculating the area of a cylinder in which it asks radius value from user and then calculate area using this radius value. Please provide me

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.