can i send cloab data from UTL SMTP WRITE RAW DATA?
hi
here is my code to send email from oracle as attachment using demomail package provided by oracle----
create or replace procedure html_mail(
p_sender varchar2, -- sender, example: 'Me <me@apple.com>'
p_recipients varchar2, -- recipients, example: 'Someone <someone@pear.com>'
p_subject varchar2, -- subject
p_text varchar2, -- text
p_filename varchar2, -- name of html file
p_blob blob -- html file
) is
conn utl_smtp.connection;
i number;
len number;
BEGIN
conn := demo_mail.begin_mail(
sender => p_sender,
recipients => p_recipients,
subject => p_subject,
mime_type => demo_mail.MULTIPART_MIME_TYPE);
demo_mail.begin_attachment(
conn => conn,
mime_type => 'application/csv',
inline => TRUE,
filename => p_filename,
transfer_enc => 'base64');
-- split the Base64 encoded attachment into multiple lines
i := 1;
len := DBMS_LOB.getLength(p_blob);
WHILE (i < len) LOOP
IF(i + demo_mail.MAX_BASE64_LINE_WIDTH < len)THEN
UTL_SMTP.Write_Raw_Data (conn
, UTL_ENCODE.Base64_Encode(
DBMS_LOB.Substr(p_blob, demo_mail.MAX_BASE64_LINE_WIDTH, i)));
ELSE
UTL_SMTP.Write_Raw_Data (conn
, UTL_ENCODE.Base64_Encode(
DBMS_LOB.Substr(p_blob, (len - i)+1, i)));
END IF;
UTL_SMTP.Write_Data(conn, UTL_TCP.CRLF);
i := i + demo_mail.MAX_BASE64_LINE_WIDTH;
END LOOP;
demo_mail.end_attachment(conn => conn);
demo_mail.attach_text(
conn => conn,
data => p_text,
mime_type => 'text/csv');
demo_mail.end_mail( conn => conn );
END;
-------------------------------------
Above i m using
p_blob blob -----to send message as attachment now i have table containg data into clob format nw if i send it as it is just changing coulmn from Pblob--- Clob
then it gives me error at UTL SMTP WRITE RAW DATA...
for that i do wrkaround as i m taking data from table as clob convert it to blob and
send as attachment ...
---
can any one guide me little that is this approcah proper?do i really need to convert data from clob to blob?
bcause in 10g Mail UTL_MAIL raw attachment i have limitation on size of email.attachment........