Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Attaching BLOB's to PLSQL email

Attaching BLOB's to PLSQL email

From: <amerar_at_iwc.net>
Date: 11 Jan 2005 13:59:41 -0800
Message-ID: <1105480781.718566.34730@z14g2000cwz.googlegroups.com>

Hi All,

I coded/copied some code from a book to enable the JavaAPI email capability in PL/SQL. Everything is working great and I can even attach text files to the email.

Howver, I am having issues when it comes to attaching something else, like a photo or any type of BLOB.

I do not know how to code it.....

Here is the calling routine. How do I define a BLOB and point to it on disk? This code was using a BFILE, which I know will not work......

declare
ret_code NUMBER;
l_bfile bfile := bfilename( 'FILE_DIR', 'photo.jpg' ) ; begin
dbms_lob.fileopen(l_bfile);
ret_code := send (

p_from => 'a_at_test.com',
p_to => 'b_at_test.com',
p_cc => NULL,
p_bcc => NULL,
p_subject => 'Java mail test',
p_body => 'This is only a test.',
p_smtp_host => 'mail.mailserver.com',
p_attachment_data => l_bfile,
p_attachment_type => 'image/jpg',
p_attachment_file_name => '/tmp/photo.jpg');
dbms_lob.fileclose( l_bfile );
if ret_code = 1 then
dbms_output.put_line ('Successfully sent email'); else
dbms_output.put_line ('Failed to sent email'); end if;
end;
/

Thanks in advance.

Arthur Received on Tue Jan 11 2005 - 15:59:41 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US