ENVIAR CORREO UTL_MAIL
The UTL_MAIL package provides a simple API to allow email to be sent from PL/SQL. In prior versions this was possible using the UTL_SMTP package, but this required knowledge of the SMTP protocol.The package is loaded by running the following scripts:
CONN sys/password AS SYSDBA @$ORACLE_HOME/rdbms/admin/utlmail.sql @$ORACLE_HOME/rdbms/admin/prvtmail.plb
SQL> grant execute on utl_mail to dbo;
In addition the SMTP_OUT_SERVER parameter must be set to identify the SMTP server:
CONN sys/password AS SYSDBA
ALTER SYSTEM SET smtp_out_server='smtp.domain.com' SCOPE=SPFILE;
ALTER SYSTEM SET smtp_out_server='WBOGEX01.telecom.esp:25' SCOPE=SPFILE;
SHUTDOWN IMMEDIATE STARTUP With the configuration complete we can now send a mail using:
BEGIN UTL_MAIL.send(sender => 'me@domain.com', recipients => 'person1@domain.com,person2@domain.com', cc => 'person3@domain.com', bcc => 'myboss@domain.com', subject => 'UTL_MAIL Test', message => 'If you get this message it worked!'); END; /
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario