Skip to Main Content
  • Questions
  • how to send email where email body more than 32 K

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Husam.

Asked: August 27, 2017 - 2:26 pm UTC

Last updated: August 31, 2017 - 7:48 am UTC

Version: 12

Viewed 1000+ times

You Asked

Hi,
am using utl_smtp.data package and i have some emails where body size more than 32 K, is there any way to send these email in one email?


Best Regards

and Connor said...

Yes, you just need to take control yourself of the boundary data and content of the attachment.

You are actually sending a single stream of data, but the content allows a mail server/client to present it to you as attachments. So the stream might look something:

MIME-Version: 1.0
To: blah@asktom.com
Cc: blah@asktom.com
From: blah@asktom.com
Subject: The subject
Reply-To: blah@asktom.com 
Content-Type: multipart/alternative; boundary="a1b2c3d4e3f2g1"
--a1b2c3d4e3f2g1
content-type: text/html;
[my html data]

--a1b2c3d4e3f2g1--
content-type: [next content type]




Nice examples here

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


Rating

  (3 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Husam Hammad, August 28, 2017 - 7:33 am UTC


Husam Hammad, August 28, 2017 - 7:45 am UTC

Hi Connor
actually i dont want to send it as an attachment, am also using UTL_SMTP pack for sending emails with attachments, but the problem in email body size larger than 32K and it will not be accepted by top managements to send email body as attachment, is there any workaround to make it happen.

Best Regards
Connor McDonald
August 29, 2017 - 1:47 am UTC

Notice my example just send a continuous stream. There is no 32k limit with UTL_SMTP - you can send emails as large as you want. You just keep calling UTL_SMTP.WRITE_DATA

Free package utl_mime may help here

Michael, August 29, 2017 - 7:14 am UTC

There is a package that greatly simplifies sending bigger and more complex HTML mails:

https://sourceforge.net/p/utlmime/

See the wiki there for an example.
https://sourceforge.net/p/utlmime/wiki/Home/
Connor McDonald
August 31, 2017 - 7:48 am UTC

nice input.

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library