title: PL/SQL send email with attachment?
body: <p>we have a table with files saved as BLOB</p>
  
  <p>I write a code that email these files as an attachment!</p>
  
  <p>everything works fine so far, but the files (EXCEL,PDF, ... what ever) are not readable by the programs, only text files and excel will open but after some error message, where PDFs all not be opened at all!</p>
  
  <p>here is the part of the code in question!</p>
  
  <pre><code>utl_smtp.write_data( l_connection, '--'|| l_boundary || utl_tcp.crlf);
  utl_smtp.write_data( l_connection, 'Content-Type: application/octet-stream' || utl_tcp.crlf);
  utl_smtp.write_data( l_connection, 'Content-Disposition: attachment; filename="' || V_NAME || '"' || utl_tcp.crlf);
  utl_smtp.write_data( l_connection, 'Content-Transfer-Encoding: base64' || utl_tcp.crlf );
  utl_smtp.write_data( l_connection, utl_tcp.crlf );   
  
  v_length := dbms_lob.getlength(V_BLOB_CONTENT);     
  
  while v_offset &lt; v_length loop
         dbms_lob.read( V(i).BLOB_CONTENT, v_buffer_size, v_offset, v_raw );
         utl_smtp.write_raw_data( l_connection, utl_encode.base64_encode(v_raw) );
         utl_smtp.write_data( l_connection, utl_tcp.crlf );
         v_offset := v_offset + v_buffer_size;
  end loop while_loop;     
  
  utl_smtp.write_data( l_connection, utl_tcp.crlf );
  </code></pre>
  
  <p>any suggestions?</p>