Skip to Main Content
  • Questions
  • Attachments Using pl/sql mail procedure

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, sreekanth.

Asked: February 29, 2004 - 9:27 pm UTC

Last updated: January 19, 2005 - 10:49 am UTC

Version: 9.2.0.4.0

Viewed 1000+ times

You Asked

Tom,

We are in the middle of testing our database migration from 8.1.7.4 to 9.2.0.4.0. Right now in our 8.1.7.4 version we use pl/sql procedure to send emails using utl_smtp, as utl_file cannot read binary files(like word and pdf), we only attatch text documents through this email procedure. After our migration to 9.2.0.4.0 we will be able to read the binary files using utl_file, so can i attach word and pdf files using pl/sql procedure using utl_smtp.write_raw_data and utl_file.get_raw to read the file?

thanks
sreekanth.g

and Tom said...

bfiles and dbms_lob have always been able to read binary files!

I would use bfiles instead personally. Just create a directory and use dbms_lob.read on it.

You can do this today in 8i!


see
</code> http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:1352202934074 <code>

for example (reads the alert log using a bfile)

Rating

  (3 ratings)

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

Comments

thanks

sreekanth gadhiraju, March 01, 2004 - 9:22 am UTC

Thanks.

A reader, March 02, 2004 - 7:33 am UTC


Send PDF documents

A reader, January 19, 2005 - 7:27 am UTC

Hi Tom,

We are hosting our database(Oracle 9i) on Solaris OS. The front end is on VB connected via MTS to the Database.
Can you please clear a few doubts :-

1.We need to send pdf documents as attachments. Now to attach this pdf to the mail ,my understanding is that the pdf should be present on the Database server(Solaris) so that it can be attached using utl_file.Is this correct?

2.If this is correct then will I have to generate the PDF's on the windows machine and then FTP these files to Solaris server(to use utl_file) or can the PDF documents be generated directly on the Solaris Server?

Thanks

Tom Kyte
January 19, 2005 - 10:49 am UTC

1) if you are sending email from the database, the attachment needs to be available on the database either as a temporary blob passed from the client, a bfile, a blob in a table....

utl_file would not be used?

2) your client VB application, using the power of SQL -- can actually send blob data to the database :)

</code> http://docs.oracle.com/docs/cd/B10501_01/appdev.920/a96591/toc.htm <code>

(your vb client could probably send the email too)

More to Explore

CLOB/BLOB/etc

Complete documentation on Securefiles and Large Objects here