Alguem sabe me dizer po pq da procedure não enviar arquivos do tipo XML ??? :-( Agora... se for arquivo texto, ela envia!! Detalhe... Arquivo "XML", de certa forma, não é um arquivo texto??
Se alguém tiver uma procedure que envie qq tipo de arquivo em anexo para disponibilizar para lista tb... seria de ótimo agrado! Thanks a lot. Procedure ENVIO_NOTES ( p_to in varchar2, p_from in varchar2, p_subject in varchar2, p_text in varchar2, p_direct in varchar2, p_file in varchar2, p_erro out varchar2 ) is wrk_email varchar2(250) := null; wrk_bite number := 0; Mensagem varchar2(32767); v_file_handle utl_file.file_type; v_line varchar2(32767); Cursor Notes is Select 25 port, p.end_ip END_IP, p.nom_ccmail Servidor from envio_ccmail p; r_notes notes%rowtype; c utl_smtp.connection; PROCEDURE send_header(name IN VARCHAR2, header IN VARCHAR2) AS BEGIN utl_smtp.write_data(c, name || ': ' || header || utl_tcp.CRLF); END; BEGIN open notes; fetch notes into r_notes; close notes; c := utl_smtp.open_connection(r_notes.END_IP,r_notes.port); utl_smtp.helo(c, R_Notes.Servidor); utl_smtp.mail(c, p_from); wrk_bite := 1; WHILE ( wrk_bite <= Length(p_to) ) LOOP IF SUBSTR(p_to,wrk_bite,1) = ',' THEN if wrk_email is not null then utl_smtp.rcpt(c, wrk_email); end if; wrk_email := null; ELSE wrk_email := wrk_email || SUBSTR(p_to,wrk_bite,1); END IF; wrk_bite := wrk_bite + 1; END LOOP; if wrk_email is not null then utl_smtp.rcpt(c, wrk_email); end if; utl_smtp.open_data(c); send_header('From', p_from); send_header('To', p_to); send_header('Subject', p_subject); mensagem:='Mime-Version: 1.0' || utl_tcp.CRLF ||'Content-Type: multipart/mixed; boundary="DMW.Boundary.605592468"' || utl_tcp.CRLF ||'' || utl_tcp.CRLF ; utl_smtp.write_data ( c, mensagem ); mensagem :=null; mensagem := mensagem || '--DMW.Boundary.605592468' || utl_tcp.CRLF ||'Content-Type: text/plain; name="message.txt"; charset=US-ASCII' || utl_tcp.CRLF ||'Content-Disposition: inline; filename="message.txt"' || utl_tcp.CRLF ||'Content-Transfer-Encoding: 7bit' || utl_tcp.CRLF ||'' || utl_tcp.CRLF; mensagem := mensagem || p_text || utl_tcp.CRLF ; utl_smtp.write_raw_data(c, utl_raw.cast_to_raw(mensagem)); v_file_handle := utl_file.fopen(p_direct, p_file, 'r' ,32767); mensagem := utl_tcp.CRLF || '--DMW.Boundary.605592468' || utl_tcp.CRLF || 'Content-Type: application/octet-stream; name="' || p_file || '"' || utl_tcp.CRLF || 'Content-Disposition: attachment; filename="' || p_file || '"' || utl_tcp.CRLF || 'Content-Transfer-Encoding: 7bit' || utl_tcp.CRLF || utl_tcp.CRLF ; utl_smtp.write_data ( c, mensagem ); begin loop utl_file.get_line(v_file_handle, v_line); mensagem := v_line || utl_tcp.CRLF ; utl_smtp.write_data ( c, mensagem ); end loop; mensagem := utl_tcp.CRLF; utl_smtp.write_data ( c, mensagem ); utl_file.fclose(v_file_handle); exception when utl_file.invalid_path then dbms_output.put_line('Error in opening attachment '); when others then null; end; utl_smtp.close_data(c); utl_smtp.quit(c); EXCEPTION WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN utl_smtp.quit(c); p_erro := ('Failed to send mail due to the following error: ' || sqlerrm); END; -------------------------------------------------------------------------------------------------------------------------- Atenção! As mensagens deste grupo são de acesso público e de inteira responsabilidade de seus remetentes. Acesse: http://www.mail-archive.com/oracle_br@yahoogrupos.com.br/ --------------------------------------------------------------------------------------------------------------------------__________________________________________________________________ Este Grupo recebe o apoio da SQL Magazine - www.devmedia.com.br/sqlmagazine __________________________________________________________________ O grupo Oracle_br não aceita anexos. Quando oferecer algum arquivo, tenha o link do mesmo para evitar trafego(pedidos) desnecessário. Links do Yahoo! Grupos <*> Para visitar o site do seu grupo na web, acesse: http://br.groups.yahoo.com/group/oracle_br/ <*> Para sair deste grupo, envie um e-mail para: [EMAIL PROTECTED] <*> O uso que você faz do Yahoo! Grupos está sujeito aos: http://br.yahoo.com/info/utos.html