Hello! Can I be forwarded to a page that describes in detail what steps to take to write a simple java mail-client? I write one but it throws exceptions. I need to know if I have to install smth additional. Say I have a mail server running on another host with IP ....... I have an email account. And all I want to do is to send a simple text(for beginning)into my inbox folder. If you could provide a simple example yourself with protocol, url, username and password specified it would be great. Thank you!
When I uncomment the commented part it throws the exception
javax.mail.NoSuchProviderException: Invalid protocol: null at javax.mail.Session.getProvider(Session.java:265) at javax.mail.Session.getStore(Session.java:363) at javax.mail.Session.getStore(Session.java:343) at javax.mail.Session.getStore(Session.java:329) at simplemail.send(simplemail.java:17) at simplemail.main(simplemail.java:35) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
Where in this code do I have to configure protocol? Thank you!
This isnt what I want! I want to retrieve a specified message for the INBOX folder. That's it. How will this
Transport transport = session.getTransport("smtp"); transport.connect(hostname, username, password); trabsport.send(message);
Joined: Dec 05, 2005
I used this.
Store store = session.getStore("smtp"); Folder folder = store.getFolder("INBOX"); folder.open(Folder.READ_WRITE); Message message = folder.getMessages(); System.out.println(message(1));
Although my INBOX folder contains a lot of messages it throws the ArrayIndexOutOfBoundsException exception. (0>=0)
As I understand the getMessages method retrieves the messages from the INBOX folder and puts them into the message array. If my INBOX folder isnt empty then it must contain smth. But it doesnt work. What is the matter?
Thank you very much! It worked! And another question. I am not familiar with JMS. I've just read couple of things on it. If a create a java application on one machine and another one on another machine. Can JMS be used here to make them communicate? If yes forward me to a page describing how this can be done, please? Thank you!
It depends on the use of the JMS queue � will the queue be located in a database e.g. Oracle, DB2� � then the answer is always YES � but will the queues be file based, then both applications must share the files location and a lot of other things � the answer is MAYBE.