Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JavaMail - Can't connect to store

843830May 18 2006 — edited May 23 2006
Hello,

I'm connecting to the server to send emails and it's OK
I don't know how it connects to the mail server, but it's getting the service like that:

IDfSessionManager sessMgr = SessionManagerHttpBinding.getSessionManager();
String servName = IDpMailClientService.class.getName();
IDfClient localClient = DfClient.getLocalClient();
m_mailServ = (IDpMailClientService) localClient.newService(servName, sessMgr);
return m_mailServ;

Then I want to save the sent email, so I'm connecting to the "store"

So, when trying to connect to the store, in order to get folders, I don't know how to get login and password of my connected user ?

Store store = mailSess.getStore("imap");
store.connect(server, login, pwd);
Folder fldr = store.getDefaultFolder();
Folder[] fldrs = fldr.list();
for (int i = 0; i < fldrs.length; i++)
{
System.out.println("Fldr name: " + fldr.getFullName());
}

Folder sentFldr = fldr.getFolder("Sent Items");
sentFldr.open(Folder.READ_WRITE);
sentFldr.appendMessages(new Message[] { mailMsg });
sentFldr.close(false);

1/ Which login and password does it use when connecting to the mail server, to send email ?

2/ If I'm putting my values in the code (login, pwd),

Store store = mailSess.getStore("imap");
store.connect(serverAddress, myLogin, myPassword);
Folder fldr = store.getDefaultFolder();

I've got the following error

MailClientService Exception ROOT CAUSE: javax.mail.MessagingException: nested exception is : java.io.IOException
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:303)
at javax.mail.Service.connect(Service.java:233)
at javax.mail.Service.connect(Service.java:134)
at com.documentum.devprog.mail.DpMailClientService.sendMessage(DpMailClientService
.java:117)

What does it mean ?


Thanks
Regards
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 20 2006
Added on May 18 2006
3 comments
325 views