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 and later
Information in this document applies to any platform.


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 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.


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.