How to send a flat file from Forms 6i, by email ?

Hello guys, I need some help in order to send a flat file that i've created, by email. I was searching in oracle documentation help and found something that seems work, but it is not. this the code:

----
PROCEDURE send_mail (sender IN VARCHAR2,
recipient IN VARCHAR2,
message IN VARCHAR2) IS
Begin
declare
mailhost VARCHAR2(30) := 'btmail.btsrv01.bantrab.net.gt';
smtp_error EXCEPTION;
mail_conn utl_tcp.connection;

PROCEDURE smtp_command(command IN VARCHAR2,
ok IN VARCHAR2 DEFAULT '250') IS
response varchar2(3);
BEGIN
utl_tcp.write_line(mail_conn, command);
response := substr(utl_tcp.get_line(mail_conn), 1, 3);
IF (response <> ok) THEN
RAISE smtp_error;
END IF;
END;

BEGIN
mail_conn := utl_tcp.open_connection(btmail, 8080);
smtp_command('HELO ' || btmail);
smtp_command('MAIL FROM: ' || sender);
smtp_command('RCPT TO: ' || recipient);
smtp_command('DATA', '354');
smtp_command(message);
smtp_command('QUIT', '221');
utl_tcp.close_connection(mail_conn);
EXCEPTION
WHEN OTHERS THEN
Message('Imposible enviar el mail, revise este error '||sqlerrm,acknowledge);
END;
end;
----

The problem occurs when I compile this procedure, it gives me an error about utl_tcp.connection; that seems isn't declared but it is. So i need to know another easier way to do this. For your help Thanks.

Daniel
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories