I am using JAMES (Java Apache Mail Enterprise Server) as a mail server, and i am aiming to develop an enterprise java mailing system using Java-mail and JAF APIs on a local mail server.
For instance, i have made a simple application for test, i used the pop3 protocol to send/receive messages between clients and everything was OK. The problem which occurred is that i want to view the sent/ deleted/ trash emails for each client which is not available in pop3 protocol. I have to use IMAP in stead. But actually, the connection to the server using IMAP protocol is not working !!
this is a sample of the code :
@Stateless
public class Mailer{
@Resource(name = "mail/JavaMailSession")
private Session session
private Message[] messages;
private Message [] outboxContent(String email,String pass){
IMAPStore store = null;
IMAPFolder outbox = null;
try{
store = (IMAPStore) session.getStore("imaps");
store.connect("localhost",-1,email,pass);
if(store.isConnected()){
outbox = (IMAPFolder) store.getFolder("sent-items");
.
.
.
The exception is being thrown at :
store.connect(....
The exception being thrown is :
java.mail.MessagingException : Connection refused : connect;
nested exception is :
java.net.ConnectionException: Connection refused : connect
Anybody has idea about the sollution ? Thanks in advance