My Oracle Support Banner

How to Send a Mail from Within PL/SQL and Java Stored Procedures. (Doc ID 73321.1)

Last updated on JANUARY 30, 2022

Applies to:

Oracle Database - Enterprise Edition - Version and later
Oracle Database Cloud Schema Service - Version N/A and later
Gen 1 Exadata Cloud at Customer (Oracle Exadata Database Cloud Machine) - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Backup Service - Version N/A and later
Information in this document applies to any platform.


This article contains an example of how to send an email message from a Java stored procedure.

The JavaMail classes are part of the Oracle JVM from version 9.2 of the database.  Additional information on the JavaMail API can be found at:

The example in this article has been tested with the following versions:

Oracle Database,,,,,,


This article is intended for users developing Java in the database. Users should have some Java knowledge in order to understand the code.  As specific permissions are required to execute the Java stored procedure, a DBA user may be needed to grant missing permissions to executing users.


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.