Home » SQL & PL/SQL » SQL & PL/SQL » UTL_SMTP unable to send attachment (Oracle9i Enterprise Edition Release 9.2.0.6.0)
UTL_SMTP unable to send attachment [message #409391] Mon, 22 June 2009 07:38 Go to next message
ganeshsv
Messages: 51
Registered: January 2006
Member
HI,

When I try to send attachment using UTL_SMTP, attachment goes as message in the body.

Following is the code which we used to notify the data as attachment.

conn := utl_smtp.open_connection( gv_smtp_server, gv_smtp_server_port );
utl_smtp.helo( conn, gv_smtp_server);
utl_smtp.mail( conn, from_name_in );
utl_smtp.rcpt(conn,to_list_in);

utl_smtp.open_data ( conn );

hdr_msg := 'From: ' || from_name_in || gc_crlf ||'subject: ' || subject_in || gc_crlf ||'To: ' || to_list_in || gc_crlf ;

utl_smtp.write_data ( conn, hdr_msg );

file_handle := utl_file.fopen( v_directory_name , filename_in, 'r');

utl_smtp.write_data(conn, '--' || '-----7D81B75CCC90D2974F7A1CBD' || utl_tcp.CRLF);
utl_smtp.write_data ( conn, 'Content-Type'||': '||'text/plain'|| utl_tcp.CRLF);
utl_smtp.write_data ( conn, 'Content-Disposition' || ': '||'inline; filename="'||filename_in||'"'|| utl_tcp.CRLF);

UTL_FILE.GET_LINE(file_handle, v_line);
mesg := v_line || gc_crlf;
utl_smtp.write_data ( conn, mesg );
utl_smtp.write_data(conn, '--' || '-----7D81B75CCC90D2974F7A1CBD' || '--' ||utl_tcp.CRLF);
utl_file.fclose(file_handle);
utl_smtp.close_data( conn );
utl_smtp.quit( conn );

could you please let know where its wrong?

Thanks in advance,
GS
Re: UTL_SMTP unable to send attachment [message #409399 is a reply to message #409391] Mon, 22 June 2009 07:49 Go to previous message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
If you are unable to write the code just copy and paste the many that already exist and are available in the web (including here).

And you are still unable to format your post accordingly to forum guide.

Regards
Michel
Previous Topic: Spreading the data evenly
Next Topic: Problem in Trigger when it is updating
Goto Forum:
  


Current Time: Sat Feb 15 02:04:10 CST 2025