You won’t likely directly use the JAF java.activation package, but JavaMail uses them.
Look on your local hard disk in the JavaMail downloaded docs J:\Program Files\javamail-1.4.\docs\javadocs\index.html or
. Look on your local hard disk in the JAF downloaded docs J:\Program Files\jaf1.1\docs\javadocs\index.html or . JavaMail and JAF docs are not part of the JDK, but the source comes with J2EE. now support the API with higher performance implementations. JavaMail does not support the Windows proprietary MAPI protocol. Sun’s implementation of JavaMail is now open source.JavaMail also supports Google Gmail and Yahoo mail.
The
is the best way to get started, since it explains how all the classes fit together. The API docs give a lot of detail, but nothing on how it all fits together. Another way to understand it is to look at the demo examples, particularly msgsend.java to send and msgshow.java to receive. The term store refers to all your messages stored on the server’s hard disk. The term folder refers to the mail messages stored on the mail server in the SMTP INBOX. Folder. getMessages just gets message headers. MimeMessage. getContent gets the message body.If you get a Message, you can’t close the Folder or Session until you are completely finished grabbing fields for the Message. Once the Session is gone, you can’t get any additional information about the Message. This is not that unusual, but it means you can’t write a method to return a Message object unless either:
Similarly you need to hold Folder and Session open in order to be able to later delete the Message from the server.
Most JavaMail applications involve reading a message and modifying it in some way and sending it on. Most mail servers will not permit you to modify the incoming message. You must create a new one and copy the parts over. There are three techniques you can use to copy.
You probably want to use transport.sendMessage ( message, recipients ), not Transport. send( message );
Often code like this fails:
message.setFlag( Flags.Flag.SEEN, true ); message.setFlag( Flags.Flag.DELETED, true );I have not yet tracked down why. I supect it may be that the Session, Folder or MimeMessage times out if you wait too long.
JavaMail is does not provide a mailserver. You might use something like James rather that using your ISP’s mailserver.
![]() |
and suggestions to improve this page to Roedy Green : | ||
| Canadian Mind Products | |||
| mindprod.com IP:[65.110.21.43] | |||
| Your face IP:[38.103.63.16] | The information on this page is for non-military use only. | ||
| You are visitor number 40,127. | Military use includes use by defence contractors. | ||
| You can get a fresh copy of this page from: | or possibly from your local J: drive (Java virtual drive/Mindprod website mirror) | ||
| http://mindprod.com/jgloss/javamail.html | J:\mindprod\jgloss\javamail.html | ||