SEND procedure - Send an e-mail to an SMTP server

The SEND procedure provides the capability to send an e-mail to an SMTP server.

Syntax

Read syntax diagramSkip visual syntax diagramUTL_MAIL.SEND(sender ,recipients,cc, bcc,subject,message,mime_type,priority)

Parameters

sender
An input argument of type VARCHAR(256) that specifies the e-mail address of the sender.
recipients
An input argument of type VARCHAR(32672) that specifies the comma-separated e-mail addresses of the recipients.
cc
An input argument of type VARCHAR(32672) that specifies the comma-separated e-mail addresses of copy recipients.
bcc
An input argument of type VARCHAR(32672) that specifies the comma-separated e-mail addresses of blind copy recipients.
subject
An input argument of type VARCHAR(32672) that specifies the subject line of the e-mail.
message
An input argument of type VARCHAR(32672) that specifies the body of the e-mail.
mime_type
An optional input argument of type VARCHAR(1024) that specifies the MIME type of the message. The default is 'text/plain; charset=us-ascii'.
priority
An optional argument of type INTEGER that specifies the priority of the e-mail The default value is 3.

Authorization

EXECUTE privilege on the UTL_MAIL module.

Examples

Example 1: The following anonymous block sends a simple e-mail message.
BEGIN
  DECLARE v_sender VARCHAR(30);
  DECLARE v_recipients VARCHAR(60);
  DECLARE v_subj VARCHAR(20);
  DECLARE v_msg VARCHAR(200);

  SET v_sender = 'kkent@mycorp.com';
  SET v_recipients = 'bwayne@mycorp.com,pparker@mycorp.com';
  SET v_subj = 'Holiday Party';
  SET v_msg = 'This year''s party is scheduled for Friday, Dec. 21 at ' || 
     '6:00 PM. Please RSVP by Dec. 15th.';
  CALL UTL_MAIL.SEND(v_sender, v_recipients, NULL, NULL, v_subj, v_msg);
END@
This example results in the following output:
BEGIN
  DECLARE v_sender VARCHAR(30);
  DECLARE v_recipients VARCHAR(60);
  DECLARE v_subj VARCHAR(20);
  DECLARE v_msg VARCHAR(200);

  SET v_sender = 'kkent@mycorp.com';
  SET v_recipients = 'bwayne@mycorp.com,pparker@mycorp.com';
  SET v_subj = 'Holiday Party';
  SET v_msg = 'This year''s party is scheduled for Friday, Dec. 21 at ' ||
     '6:00 PM. Please RSVP by Dec. 15th.';
  CALL UTL_MAIL.SEND(v_sender, v_recipients, NULL, NULL, v_subj, v_msg);
END
DB20000I  The SQL command completed successfully.