How do I send e-mail through Oracle triggers?

Mark Bradley

A good set of responses I've seen is from the Oracle Magazine. From there select the "Ask Tom" column. You can search his articles for "JavaMail" or just "mail". It has responses for Oracle 8i and previous releases. Versions prior to 8.1.5 rely on Oracle packages instead of Java.

The questions and answers on that page are, naturally, heavily Oracle-specific!

It describes a way to load the activation.jar and mail.jar files (which cannot be compressed) into the database using the "loadjava" program.

There is Java and PL/SQL sample code which supports attachments using BLOBs. It has the repackaged JAR files.

You will need to modify the code to handle your specific needs. Load this code, then just call the PL/SQL function from the trigger.