If you goto </code>
http://java.sun.com/products/javamail/index.html, <code>you¡¦ll be able to download their Java Mail API. The download you get will consist of a couple of hundred files ¡V only one of which we are interested in. After you download the Java mail API ¡V make sure also to get their the JavaBeansTM Activation Framework extension or JAF (javax.activation). This is needed to run the Java mailapi package.
After you have downloaded these two sets of files ¡V you will need to extract mail.jar from the Java mailapi download and activation.jar from the JAF download. This is all you will need from this ¡V feel free to read through the documentation, there is a lot of functionality in there we are not using, we are just using the ¡§send an email¡¨ part of the API. The API includes functions for receiving mail as well from IMAP, POP and other sources.
We will need to load the mail.jar and activation.jar into the database using loadjava but before we can do that we must repackage them. These jar files are compressed in a format that is not understood by the database byte code interpreter. You need to ¡§unjar¡¨ and ¡§rejar¡¨ them without compression OR use a tool such as WinZip to ¡§rejar¡¨ them into a zip file. What I did on Windows 2000 was:
1. Used WinZip to extract the contents of mail.jar into my c:\temp\mail directory
2. Used WinZip to create a new archive c:\temp\mail8i.zip
3. Put the contents of c:\temp\mail\*.* including subdirectories into this new archive
I did the same thing for activation.jar ¡V only replacing mail with activation in the above steps. Now we are ready to load these zip (or jar files, whatever you named them) into the database. These need to be loaded using the SYS user since they have 'protected' Java packages that regular users cannot upload. We will use the commands:
loadjava -u sys/manager -o -r -v -f -noverify -synonym -g public mail8i.zip
loadjava -u sys/manager -o -r -v -f -noverify -synonym -g public activation8i.zip
Where:
á -u sys/manager: is the userid and password for your SYS account. As stated previously, some of the packages are protected and must be loaded as SYS
á -o: is shorthand for -oci8, I am using the oci8 driver. You could use the thin driver as well but you¡¦ll need to modify the the command to do so
á -r: is short for ¡Vresolve. This will resolve all external references in the loaded classes helping to verify that the loaded java classes will be able to function after we load them
á -v: is short for ¡Vverbose. This gives us something to do while loadjava is running. We can see it work through each step of its process.
á -f: is short for ¡Vforce. This isn¡¦t necessary on the first load but is OK to use. If you try a load and hit and error, correct it and reload ¡V then you would either need to dropjava the jar file or use ¡Vforce. Using ¡Vforce just makes it easier for us.
á -noverify: does not attempt to verify the bytecode. You must be grantedoracle.aurora.security.JServerPermission(Verifier) to execute this option. In addition, this option must be used in conjunction with -r. SYS has this privilege. This is needed because the bytecode verifier will flag some issues with the mail.jar file and this works around that issue.
á -synonym: creates public synonyms for these classes. Since we will NOT install the mail java code we write as SYS, this allows us to ¡§see¡¨ the SYS loaded java classes.
á -g public: grants execute on these loaded classes to PUBLIC. If this is not desirable, change the ¡Vg to be just the user you want to create the ¡§send mail¡¨ routines in, for example ¡§-g UTILITY_ACCT¡¨.