Postgres Plus Advanced Server Oracle Compatibility Developer's Guide : 7.11 UTL_MAIL

Previous PageTable Of ContentsNext Page

Postgres Plus Advanced Server Oracle Compatibility Developer's Guide

 

7.11 UTL_MAIL

The UTL_MAIL package provides the capability to manage e-mail.

Note: An administrator must grant execute privileges to each user or group before they can use this package.

Table 7-19 UTL_MAIL Functions/Procedures

Function/Procedure

Function or Procedure

Return Type

Description

SEND(sender, recipients, cc, bcc, subject, message [, mime_type [, priority ]])

Procedure

n/a

Packages and sends an e-mail to an SMTP server.

SEND_ATTACH_RAW(sender, recipients, cc, bcc, subject, message, mime_type, priority, attachment [, att_inline [, att_mime_type [, att_filename ]]])

Procedure

n/a

Same as the SEND procedure, but with BYTEA or large object attachments.

SEND_ATTACH_VARCHAR2(sender, recipients, cc, bcc, subject, message, mime_type, priority, attachment [, att_inline [, att_mime_type [, att_filename ]]])

Procedure

n/a

Same as the SEND procedure, but with VARCHAR2 attachments.

7.11.1 SEND

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

SEND(sender VARCHAR2, recipients VARCHAR2, cc VARCHAR2,
  bcc VARCHAR2, subject VARCHAR2, message VARCHAR2
  [, mime_type VARCHAR2 [, priority PLS_INTEGER ]])

Parameters

sender

E-mail address of the sender.

recipients

Comma-separated e-mail addresses of the recipients.

cc

Comma-separated e-mail addresses of copy recipients.

bcc

Comma-separated e-mail addresses of blind copy recipients.

subject

Subject line of the e-mail.

message

Body of the e-mail.

mime_type

Mime type of the message. The default is text/plain; charset=us-ascii.

priority

Priority of the e-mail The default is 3.

Examples

The following anonymous block sends a simple e-mail message.

DECLARE
    v_sender        VARCHAR2(30);
    v_recipients    VARCHAR2(60);
    v_subj          VARCHAR2(20);
    v_msg           VARCHAR2(200);
BEGIN
    v_sender := 'jsmith@enterprisedb.com';
    v_recipients := 'ajones@enterprisedb.com,rrogers@enterprisedb.com';
    v_subj := 'Holiday Party';
    v_msg := 'This year''s party is scheduled for Friday, Dec. 21 at ' ||
             '6:00 PM. Please RSVP by Dec. 15th.';
    UTL_MAIL.SEND(v_sender,v_recipients,NULL,NULL,v_subj,v_msg);
END;

7.11.2 SEND_ATTACH_RAW

The SEND_ATTACH_RAW procedure provides the capability to send an e-mail to an SMTP server with an attachment containing either BYTEA data or a large object (identified by the large object's OID). The call to SEND_ATTACH_RAW can be written in two ways:

SEND_ATTACH_RAW(sender VARCHAR2, recipients VARCHAR2,

cc VARCHAR2, bcc VARCHAR2, subject VARCHAR2, message VARCHAR2,

mime_type VARCHAR2, priority PLS_INTEGER,

attachment BYTEA[, att_inline BOOLEAN

[, att_mime_type VARCHAR2[, att_filename VARCHAR2 ]]])

SEND_ATTACH_RAW(sender VARCHAR2, recipients VARCHAR2,

cc VARCHAR2, bcc VARCHAR2, subject VARCHAR2, message VARCHAR2,

mime_type VARCHAR2, priority PLS_INTEGER, attachment OID

[, att_inline BOOLEAN [, att_mime_type VARCHAR2

[, att_filename VARCHAR2 ]]])

Parameters

sender

E-mail address of the sender.

recipients

Comma-separated e-mail addresses of the recipients.

cc

Comma-separated e-mail addresses of copy recipients.

bcc

Comma-separated e-mail addresses of blind copy recipients.

subject

Subject line of the e-mail.

message

Body of the e-mail.

mime_type

Mime type of the message. The default is text/plain; charset=us-ascii.

priority

Priority of the e-mail. The default is 3.

attachment

The attachment.

att_inline

If set to TRUE, then the attachment is viewable inline, FALSE otherwise. The default is TRUE.

att_mime_type

Mime type of the attachment. The default is application/octet.

att_filename

The file name containing the attachment. The default is NULL.

7.11.3 SEND_ATTACH_VARCHAR2

The SEND_ATTACH_VARCHAR2 procedure provides the capability to send an e-mail to an SMTP server with a text attachment.

SEND_ATTACH_VARCHAR2(sender VARCHAR2, recipients VARCHAR2,
  cc VARCHAR2, bcc VARCHAR2, subject VARCHAR2, message VARCHAR2,
  mime_type VARCHAR2, priority PLS_INTEGER, attachment VARCHAR2
  [, att_inline BOOLEAN [, att_mime_type VARCHAR2
  [, att_filename VARCHAR2 ]]])

Parameters

sender

E-mail address of the sender.

recipients

Comma-separated e-mail addresses of the recipients.

cc

Comma-separated e-mail addresses of copy recipients.

bcc

Comma-separated e-mail addresses of blind copy recipients.

subject

Subject line of the e-mail.

message

Body of the e-mail.

mime_type

Mime type of the message. The default is text/plain; charset=us-ascii.

priority

Priority of the e-mail The default is 3.

attachment

The VARCHAR2 attachment.

att_inline

If set to TRUE, then the attachment is viewable inline, FALSE otherwise. The default is TRUE.

att_mime_type

Mime type of the attachment. The default is text/plain; charset=us-ascii.

att_filename

The file name containing the attachment. The default is NULL.

Previous PageTable Of ContentsNext Page