My Oracle Support Banner

Simple Example of Sending Attachments Using UTL_SMTP (Doc ID 414062.1)

Last updated on JULY 05, 2023

Applies to:

PL/SQL - Version 10.1.0.2 and later
Information in this document applies to any platform.

Goal

How to send an E-Mail with attachment using the PL/SQL package UTL_SMTP. The sample code uses the DBMS_LOB package to open and read the given file and encodes the attachment using UTL_ENCODE package to base64 format. This method will work with most types of file, but you will need to modify the mime type as noted in the code comments.

From version 11.1.0.6 onward's ACL needs to be configured before running the sample code. If ACL is not configured, the code will fail with ORA-24247 error. Refer to <note 1209644.1> on how to configure ACL.

Solution

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
Goal
Solution
References

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