Skip to Main Content
  • Questions
  • UTL_MAIL with larger size and multiple .csv file attachments

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question.

Asked: January 12, 2024 - 4:58 pm UTC

Last updated: January 16, 2024 - 3:12 pm UTC

Version: Oracle 19C

Viewed 1000+ times

You Asked

Hi,

Currently i am using UTL_MAIL.SEND_ATTACH_VARCHAR2 to send attachments but there is a size limitation of 32767 chars per file. Is it possible to increase the size of the parameter by which i mean changing the parameter to a CLOB parameter so that it can accommodate more values.

I did a work around for this using UTL_FILE to write to a file in filesystem and use unix mail cmd to attach multiple files.

“mail -s “Attachment test” -a file1.csv -a file2.csv -file3.csv abc@xyz.com < file5.csv”

but i want this from pl/sql since i am using a global temp table with HTML content displaying in the body of the email.

Is it possible to expect this feature in utl_mail package in the future?

to send a file with larger size like say 5MB or 10MB.
to send multiple files 5 or 10 files.

PS i tried using UTL_MAIL.SEND_ATTACH_RAW as well the attachment doesn't get picked up

and Chris said...

A SEND_ATTACH_CLOB procedure could be added - raise an enhancement request on support.oracle.com.

If this is implemented you'll have to wait a while for it to be delivered. There are other alternatives available now.

If you have APEX installed, you can use APEX_MAIL. The ADD_ATTACHMENT procedure in this has CLOB/BLOB overloads.

If you don't, you can use UTL_SMTP. The process is more convoluted; Tim Hall has put together an example:

https://oracle-base.com/articles/misc/email-from-oracle-plsql#clob

Rating

  (1 rating)

Comments

Thank you Chris.

Jagan Tirumalai, January 15, 2024 - 4:25 pm UTC




Chris Saxon
January 16, 2024 - 3:12 pm UTC

You're welcome.

More to Explore

CLOB/BLOB/etc

Complete documentation on Securefiles and Large Objects here