Clicky

Oracle - Send mail with UTL_SMTP

February 18, 2013

Procedure PL/SQL to send a email using UTL_SMTP package:
Declare
  l_mail_conn   UTL_SMTP.connection;
BEGIN
  l_mail_conn := UTL_SMTP.open_connection('', 25);
  UTL_SMTP.helo(l_mail_conn, ‘
');
  UTL_SMTP.mail(l_mail_conn, ‘');
  UTL_SMTP.rcpt(l_mail_conn, '  UTL_SMTP.data(l_mail_conn, '’ || UTL_TCP.crlf || UTL_TCP.crlf);
  UTL_SMTP.quit(l_mail_conn);
END;