How can I retrive mail from servers

Hello Sir/madam,I want to develop an application,which fetch all mails from my all mail accounts & send me in my local mail account.Would you help me by suggessions?Plese
[202 byte] By [kripa_ostwala] at [2007-11-27 8:15:00]
# 1

You need something like that...

Pop3 pop = new Pop3("c:\\temp", "pop.xxxx.fr", "xxxx", "xxxx"); // accept protocol POPS & IMAPS

EMail fox = new EMail("smtp.gmail.com");

try

{

Message[] pop_message = pop.getMail(true);

for (int i = 0, n = pop_message.length; i < n; i++)

{

// SSL connexion ?

//fox.setSecureSMTP(true); // defaut false

fox.setPort(25); // gmail 25 (Ok ssl false), 465 (ok SSL true), 587 (Ok ssl false!)

fox.setAuthentication("xxxx", "xxxx");

fox.setTLS(true); // gmail

// active le d閎uggage

fox.setDebug(true);

// active l'envoie du mail partiel, si une des adresses emails n'est pas valide!!!

fox.setPartial(true);

// ajouter un destinataire

//fox.addToAddress("test@xxx.fr");

// attacher un destinataire d'adresse de reponse

//fox.addReplyTo("fox@xxxx.fr");

// priorit?du mail : 0 basse, 1 moyenne, 2 haute

fox.setPriority(2);

// exemple forward

fox.sendForward("test@xxxx.fr", "faa@xxxx.fr", "ceci est un forward!", pop_message[i]);

// exemple redirect

//fox.deleteAllAddress();

//fox.sendRedirect("test@xxxx.fr", "faa@xxxx.fr", pop_message[i]);

// efface le message du serveur pop3

//pop_message[i].setFlag(javax.mail.Flags.Flag.DELETED, true);

}

}

catch (Exception e)

{

System.out.println(e);

e.printStackTrace();

}

finally

{

// ferme la session pop3 et efface les messages flagger 'DELETED' !

try { pop.close(true); } catch (MessagingException me) { }

}

Ask me the code at nexus6<AT>altern.org it's GNU General Public License...

alterna at 2007-7-12 19:59:42 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

The JavaMail web site (http://java.sun.com/products/javamail) has

everything you need. There are sample programs and tutorials that

explain how to fetch messages from a mailbox and how to send

messages. Given those basic capabilities, I assume you can

assemble them together to build your application.

bshannona at 2007-7-12 19:59:42 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
Thanx BUT it gives me error such asPOP3 & Email in 1st 2 lines What changes will do Pls tell me because I don't know more about it
kripa_ostwala at 2007-7-12 19:59:42 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4
kripa_ostwal,STOP DEVELOPEMENT for the moment....go here and read all : http://java.sun.com/docs/books/tutorial/index.html(and come back after...)
alterna at 2007-7-12 19:59:42 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 5
Ignore the code posted above. Use the code that comes with JavaMail.And please do read the JavaMail spec (also included in the JavaMaildownload bundle, and available separately from the JavaMail web page).Did I mention the JavaMail FAQ?
bshannona at 2007-7-12 19:59:42 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...