Send out email with utl_smtp : utl_smtp « System Packages « Oracle PL/SQL Tutorial






SQL>
SQL>
SQL> set echo on
SQL>
SQL> create or replace
  2  PROCEDURE send_mail (p_sender    IN VARCHAR2,
  3                       p_recipient IN VARCHAR2,
  4                       p_message   IN VARCHAR2)
  5  as
  6     l_mailhost VARCHAR2(255) := 'mailhost.yourServer.com';
  7     l_mail_conn utl_smtp.connection;
  8  BEGIN
  9     l_mail_conn := utl_smtp.open_connection(l_mailhost, 25);
 10     utl_smtp.helo(l_mail_conn, l_mailhost);
 11     utl_smtp.mail(l_mail_conn, p_sender);
 12     utl_smtp.rcpt(l_mail_conn, p_recipient);
 13     utl_smtp.open_data(l_mail_conn );
 14     utl_smtp.write_data(l_mail_conn, p_message);
 15     utl_smtp.close_data(l_mail_conn );
 16     utl_smtp.quit(l_mail_conn);
 17  end;
 18  /

Warning: Procedure created with compilation errors.

SQL>








31.40.utl_smtp
31.40.1.send email
31.40.2.Send out email with utl_smtp