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

Last updated on JULY 26, 2017

Applies to:

PL/SQL - Version 10.1.0.2 and later
Information in this document applies to any platform.
*** Checked for relevance on 25th Jul 2017 ***

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

Sign In with your My Oracle Support account

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

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms