Home » Developer & Programmer » JDeveloper, Java & XML » Re: Sending file attachment using UTL_SMTP package
Re: Sending file attachment using UTL_SMTP package [message #366775] Tue, 19 December 2000 13:17
Kurt Ehrler
Messages: 2
Registered: December 2000
Junior Member
I've had success sending .csv files as attachments using this package.

Here's a piece of what I'm using:
conn:= utl_smtp.open_connection( v_smtp_server, v_smtp_server_port );
utl_smtp.helo( conn, v_smtp_server );
utl_smtp.mail( conn, v_send_addr );
utl_smtp.rcpt( conn, sched_query_rec.email_addr );

mesg:= 'Date: ' || TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' ) || crlf ||
'From: ' || v_send_name || ' <' || v_send_addr || '>' || crlf ||
'Subject: '|| sched_query_rec.query_name || ': Completed ' || TO_CH
AR(sched_query_rec.query_finished,'DD MON RRRR HH24:MI:SS') || crlf ||
'To: ' || sched_query_rec.user_name || '<' || sched_query_rec.email
_addr ||'>' || crlf ||
'Your query "' || sched_query_rec.query_name ||'" has been complete
d. The output can be viewed below. '||crlf||
'MIME-Version: 1.0'||crlf||
'Content-Type: '||v_mime_type||crlf||
'Content-Transfer-Encoding: 7bit'||crlf||
'Content-Disposition: '||v_mime_content||'; filename="output.'||
v_file_ext||'"'||crlf||
'' || crlf ||
'Your query "' || sched_query_rec.query_name ||'" results have exc
eeded the maximum output size. The first block is below. The entire output can b
e viewed here.'||

v_output1; -- Data to appear in attachment.
utl_smtp.data( conn, mesg );


Parameters included are
mime_type = application/msexcel
mime_content_disposition = inline

conn UTL_SMTP.CONNECTION;
crlf VARCHAR2( 2 ):= CHR( 13 ) || CHR( 10 );
mesg VARCHAR2( 32767 );


The one problem I've run into is size limitations of of my output. I haven't figured out a way to exceed file sizes of 32,767 characters. Anyone have a work around for that?
Previous Topic: BARRISTER
Next Topic: Word Doc to XML converter
Goto Forum:
  


Current Time: Fri Nov 22 23:14:07 CST 2024