-1
I need to create a precedent enviar_email_servidores
call in another pr_envia_email
.
The term to be called (pr_envia_email
) has the function of sending email, and I need the message sent to this email is the result of a query (ex: send email to all servers that do birthday in the current month).
Below the code of the Procedure sending email (pr_envia_email
)
create or replace PROCEDURE pr_envia_email
(
Arg_Mensagem varchar2,
Arg_Email_Origem varchar2,
Arg_Email_Destino varchar2
)
is
mail_conn UTL_SMTP.connection;
mailhost varchar2(100);
begin
begin
select end_serv_email into mailhost
from srh2.tab_tribunal;
end;
begin
mail_conn := utl_smtp.open_connection(mailhost, 25);
utl_smtp.helo(mail_conn, mailhost);
utl_smtp.mail(mail_conn, Arg_Email_Origem);
utl_smtp.rcpt(mail_conn, Arg_Email_Destino);
utl_smtp.open_data(mail_conn);
utl_smtp.write_data(mail_conn, 'Content-Type: text/html;charset="iso-8859-1' || utl_tcp.crlf );
-- UTL_SMTP.write_data(mail_conn, Arg_Mensagem);
UTL_SMTP.write_raw_data(mail_conn, utl_raw.cast_to_raw(Arg_Mensagem));
UTL_SMTP.close_data(mail_conn);
utl_smtp.quit(mail_conn);
end;
end;
I already did. Anyway, thank you :)
– Julie
Don’t forget to post the answer ^^
– stringnome