Skip Headers
Oracle® Mail Application Developer's Guide
10g Release 1 (10.1.2)

Part Number B25459-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

1 PL/SQL API Reference

In recent years a number of applications like order processing, bill payment, and marketing systems rely on email as a mechanism for customer interaction. Since most of these applications already have an Oracle database back-end, they alo benefit greatly by having a PL/SQL SDK for messaging operations. This chapter describes a set of PL/SQL packages with a set of PL/SQL functions and procedures for performing messaging and folder-related tasks like listing folders, retrieving a listing list of messages, and reading and sending messages. The SDK offers the complete set of functionality needed to develop an email client. This chapter describes each of the interfaces and how to use them along with their limitations and restrictions of use.The audience for this chapter includes application developers and client developers who wish to integrate with an Oracle Mail server and write email-enabled applications. The reader is assumed to be familiar with Internet standards for email, such as SMTP, MIME and S/MIME.

The PL/SQL SDK

The PL/SQL SDK consists of three sets of functionality: Session Management, Folder Operations, and Message Operations.

Session Management

Session management includes setting up an email server session, authentication, and disconnect. Both simple text-password authentication and strong authentication are supported. Session Management uses and depends on the Directory and Security API for authentication.

Folder Management

Folder functions are all operations for a folder. This includes functions for listing folders and subscription management, as well as creating, deleting, renaming, searching, and sorting on a folder. The second set of folder functions are for manipulating messages in the folder, these are functions for listing messages in the folder, copying messages, saving messages, deleting messages, checking for modifications to the folder, and retrieving new mail.

Message Management

The Message functions are all operations for a message. This includes functions for reading, composing, sending, and appending messages. To hide the complexity of MIME structure and message encoding, it contains functions to get headers, to get individual body parts, to get body part content, and to construct messages using individual body parts. It also includes S/MIME functionality to verify message signatures, decrypt messages, and send encrypted and/or signed messages.


Overview

Concepts

This section discusses the following e-mail related concepts:

Folder UIDL

When a folder is created, a validity value is assigned to the folder guaranteeing that as long as the value does not change, the message unique identifier (UID) assigned to the messages in the folder is valid. This value is called folder unique identifier validity (UIDL).

Each message in a folder is assigned a unique identifier validity (UID) value. The UID value persists across sessions, so application may cache these message UID values for message reference in the future. Message UID is always assigned in ascending order in the folder. As each message is added to the folder, it is assigned a higher UID value. The maximum UID permitted is 232 – 1 = 4 billion. Once the maximum has been reached the message UIDs in the folder are re-assigned. The holes in the message UID sequence created by messages deletion are compacted. To reflect this, the folder validity value (Folder UIDL) is changed. When the folder validity value is changed, the application must discard any message UID cache for this folder and re-fetch the message UID values.

Message Flags

Message content cannot be modified, but mail users can change the flag property. When a message is delivered into the user's INBOX folder, the message is not marked with any flag. After the user read a message, the application marks the message with the seen flag.The supported flags are described below:

Table 1-1 Supported Message Flags

Flag Description

MAIL_MESSAGE.GC_SEEN_FLAG

The message has been read

MAIL_MESSAGE.GC_FLAGGED_FLAG

Marks messages for urgent or special attention

MAIL_MESSAGE.GC_ANSWERED_FLAG

The message has been replied to

MAIL_MESSAGE.GC_DELETED_FLAG

The message is marked to be removed later with the expunge command

MAIL_MESSAGE.GC_DRAFT_FLAG

The message has not completed composition


New and Recent Messages

New and recent messages only differ when there are multiple client sessions accessing the same mail folder at the same time. A message is considered recent when no other mail client session has retrieved the message. A message is considered new if the current mail user session has not seen the message.

MIME Level

A message MIME level is a string used to identify a specific part of a message. The application does not have to know anything about it. The MIME level is incorporated as part of the message and body-part objects that are passed around. It is for internal use to identify a specific message part.

Mail Objects

There are three distinct mail objects in the Oracle Mail Server:

A mail account contains many mail folders. A mail folder contains many mail messages. An INBOX mail folder is a special folder created when the mail user account is created. The INBOX folder cannot be deleted. All incoming messages are delivered into the INBOX folder.

A mail user must be authenticated before performing mail operations. The MAIL_SESSION package provides the functions. When a user is authenticated, a valid session identifier is returned from the authentication routine. This session identifier is passed around to other mail operations that require a valid authenticated session. The mail user session identifier is only valid in the same database session that it has been authenticated in. Multiple mail user sessions are supported so that multiple mail users can authenticate on the same database session. Each authenticated session is associated with a unique identifier.

To access any message in a folder, the user must open the folder. There is only one opened folder in a mail session at any given time. The open folder changes when the folder is closed or another folder is opened.


Note:

The PL/SQL API contains references to dbms_sql.varchar2_table and dbms_sql.number_table types


See Also:

The Oracle Supplied Packages Reference manual for the description of these two types.


MAIL_FOLDER_OBJ

The MAIL_FOLDER_OBJ object uniquely identifies a mail folder. It is defined as follows:

MAIL_FOLDER_OBJ(
     name VARCHAR2(1024), 
     id   NUMBER 
);
MAIL_FOLDER_LIST AS TABLE OF MAIL_FOLDER_OBJ;


MAIL_FOLDER_DETAIL

The MAIL_FOLDER_DETAIL object contains information pertaining to a specific folder. It is defined as follows:

MAIL_FOLDER_DETAIL (
    uidl             NUMBER,
    num_voice_recent NUMBER,
    num_fax_recent   NUMBER,
    total_recent     NUMBER,
    num_voice_unseen NUMBER,
    num_fax_unseen   NUMBER,
    total_unseen     NUMBER,
    total_msgs       NUMBER 
);
CREATE TYPE MAIL_FOLDER_LIST AS TABLE OF MAIL_FOLDER_OBJ;

The MAIL_FOLDER_DETAIL object contains information on the folder UIDL, number of messages, total number of unseen and recent messages, and number of unseen and recent voice and fax messages.


MAIL_SORT_CRITERIA_ELEMENT

The MAIL_SORT_CRITERIA_ELEMENT object is used to represent a sort criteria. It is defined as follows:

MAIL_SORT_CRITERIA_ELEMENT(
    sort_header VARCHAR2(240), 
    sort_order  INTEGER 
);
MAIL_SORT_CRITERIA AS TABLE OF MAIL_SORT_CRITERIA_ELEMENT;

MAIL_MESSAGE_OBJ

The MAIL_MESSAGE_OBJ object uniquely identifies a mail message. It is defined as follows:

MAIL_MESSAGE_OBJ (
    folder_id  NUMBER, 
    msg_uid    NUMBER, 
    mime_level VARCHAR2(240)
);
MAIL_MESSAGE_LIST IS TABLE OF MAIL_MESSGAGE_OBJ;


MAIL_BODYPART_OBJ

The MAIL_BODYPART_OBJ object uniquely identifes a mail message part. It is defined as follows:

MAIL_BODYPART_OBJ (
    content_type VARCHAR2(240), 
    mime_level VARCHAR2(240), 
    folder_id NUMBER, 
    msg_uid NUMBER, 
    smime_ind NUMBER 
);
MAIL_BODYPART_LIST IS TABLE OF MAIL_BODYPART_OBJ;


MAIL_MESSAGE_HEADER

The MAIL_MESSAGE_HEADER object identifes a mail message header. It is defined as follows:

MAIL_MESSAGE_HEADER (
    msg_uid            NUMBER,
    from_str           VARCHAR2(2000),
    subject            VARCHAR2(2000),
    content_type       VARCHAR2(2000),
    x_orcl_messagetype VARCHAR2(2000),
    x_orcl_mediatype   VARCHAR2(2000),
    sensitivity        VARCHAR2(2000),
    importance         VARCHAR2(2000)
);
TYPE MAIL_MESSAGE_HEADER_LIST IS TABLE OF MAIL_MESSAGE_HEADER;


MAIL_RECOVERY Package


Note:

This package will no longer be supported from 10.1.1 onwards. Please do not use this package. It will be deprecated in future releases.

The MAIL_RECOVERY package is provided to recover deleted e-mails, using the Oracle log miner feature.

The redo list file is used by the mail_recovery package to retrieve the list of redo logs. This file must be provided by anadministrator, and can be created manually through a text editor or by outputting a directory list command on UNIX or Windows NT.

The file contains redo log filenames with their full path, and must be listed in separate lines. The redo logs can either be online redo logs, archived logs or both.

It is important to verify that init.ora parameter UTL_FILE_DIR is set to access the redo list file. For example:

/oracle/database/redo01.log
/oracle/database/redo02.log
/oracle/database/redo03.log

The MAIL_RECOVERY package contains the following procedures:


SETUP_LOGMNR Procedure

The setup_logmnr procedure initializes the log miner for recovery.

Syntax

PROCEDURE setup_logmnr(
    p_dictionary_filename   IN VARCHAR2,
    p_redolist_location     VARCHAR2,
    p_redolist_filename     VARCHAR2
    p_starttime              DATE DEFAULT '01-jan-1988',
    p_endtime                DATE DEFAULT '01-jan-2099')

Parameters

Table 1-2 SETUP_LOGMNR Procedure

Parameters Description

p_dictionary_filename

Name of the log miner data dictionary file with the full path

p_redolist_location

Directory location of redo list file

p_redolist_filename

File name of redo list file

p_starttime

Start time of the redo list. Only consider redo records with the time stamp greater than or equal to the start time specified

p_endtime

End time of the redo list. Only consider redo records with time stamp less than or equal to the end time specified



RECOVER_MESSAGES Procedure

The recover_messages procedure performs the recovery for a user and restores the messages in a specified folder.

Syntax

PROCEDURE recover_messages(
    p_domainname IN VARCHAR2,
    p_username   IN VARCHAR2,
    p_foldername IN VARCHAR2,
    p_autocommit IN BOOLEAN DEFAULT TRUE);

Parameters

Table 1-3 RECOVER_MESSAGES Procedure

Parameter Description

p_domainname

Domain name of the user

p_username

Oracle Mail user name for which recovery is performed

p_foldername

Folder name where recovered messages are restored. If NULL, it is passed, and recover_messages creates a new folder with name RECMSG_current_date_time.

p_autocommit

If True: Frequent commits are performed within recover_messages. If False: No commits are performed inside the recover_messages procedure. The end_logmnr procedure finishes the logminer session.



MAIL_SESSION Package

The MAIL_SESSION package provides user authentication and log out functionality. A user can create multiple mail sessions using the same database session by calling MAIL_SESSION.login()multiple times. Each session ID identifies one valid mail session.

The MAIL_SESSION Package contains the following procedures:


LOGIN Procedure

This procedure authenticates a user by user name and password. One of the overloaded versions of this API also accepts an authenticated ES_LOGIN_CONTEXT and returns a mail session identifier.

Throws Exceptions

mail_errors.login_err

Syntax

PROCEDURE login (
    user_name   IN VARCHAR2,
    password    IN VARCHAR2,
    domain      IN VARCHAR2,
    ldap_host   IN VARCHAR2,
    session_id  OUT NUMBER,
    ldap_port   IN NUMBER DEFAULT 389
);
PROCEDURE login (
    user_address  IN VARCHAR2,
    password      IN VARCHAR2,
    ldap_host     IN VARCHAR2,
    session_id    OUT NUMBER,
    ldap_port     IN NUMBER DEFAULT 389
);

Parameters

Table 1-4 LOGIN parameters

Parameter Description

user_name

User account name, without the domain part

password

User password

user_address

User Internet address: user_name@domain

domain

User domain

ldap_host

The host name where Oracle Internet Directory is configured

ldap_port

The port Oracle Internet Directory is listening to; the default is 389

esds_context

The authenticated ES_LOGIN_CONTEXT object.

session_id

An unique identifier that represents this user authenticated session



LOGOUT Procedure

This procedure releases all resources associated with this user session.

Syntax

PROCEDURE logout (
    session_id IN NUMBER
);

Parameters

Table 1-5 LOGOUT Procedure parameters

Parameters Description

session_id

An identifier that represents a user's authenticated session



GET_CURRENT_USAGE Procedure

This procedure returns the current user's usage amount.

Throws Exceptions

mail_errors.unauthenticated_err

Syntax

PROCEDURE get_current_usage (
    session_id IN NUMBER,
    usage OUT NUMBER
);

Parameters

Table 1-6 GET_CURRENT_USAGE Procedure parameters

Parameters Description

session_id

An identifier that represents a user's authenticated session

usage

User's current usage in bytes



MAIL_FOLDER Package

The MAIL_FOLDER package provides folder-related functionality. The validity of the session is checked before performing any operation. The search and sort features are based on the IMAP4 protocol. The search feature includes Oracle Text based searches.

The MAIL_FOLDER contains the following procedures and functions:


GET_FOLDER_OBJ Procedure

This procedure returns a folder object, given a folder name. If the folder does not exist on the mail store, a FOLDER_NOT_FOUND exception is raised.

Throws Exception

mail_errors.unauthenticated_err

mail_errors.folder_not_found_err

Syntax

PROCEDURE get_folder_obj (
    session_id    IN NUMBER,
    folder_name   IN VARCHAR2,
    folder_obj    OUT MAIL_FOLDER_OBJ
);

Parameters

Table 1-7 GET_FOLDER_OBJ Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

folder_name

The full path of a folder name.

folder_obj

The MAIL_FOLDER_OBJ returned.



GET_SEPARATOR

This function returns the folder separator.

Syntax

FUNCTION get_separator return VARCHAR2;

LIST_TOPLEVEL_FOLDERS Procedure

This procedure returns a list of top-level folder objects.

Throws Exceptions

mail_errors.unauthenticated_err

Syntax

PROCEDURE list_toplevel_folders (
    session_id    IN NUMBER,
    folder_list   OUT MAIL_FOLDER_LIST
);

Parameters

Table 1-8 LIST_TOPLEVEL_FOLDERS Parameters

Parameters Description

session_id

An identifier that represents a user's authenticated session

folder_list

A list of top-level folder objects



LIST_FOLDERS Procedure

This procedure returns a list of direct child folder objects, given the parent folder.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_not_found_err

Syntax

PROCEDURE list_folders (
    session_id    IN NUMBER,
    parent_name   IN VARCHAR2,
    folder_list   OUT MAIL_FOLDER_LIST
);
PROCEDURE list_folders ( 
    session_id  IN  NUMBER,
    parent_obj  IN  MAIL_FOLDER_OBJ,
    folder_list OUT MAIL_FOLDER_LIST
);

Parameters

Table 1-9 LIST_FOLDERS Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

parent_name

The full path of the parent folder

parent_obj

The MAIL_FOLDER_OBJ representing the parent folder

folder_list

The list of child folder objects under the parent folder



LIST_TOPLEVEL_SUBDFLDRS Procedure

This procedure returns a list of top-level subscribed folders.

Throws Exception

mail_errors.unauthenticated_err

Syntax

PROCEDURE list_toplevel_subdfldrs (
    session_id      IN NUMBER,
    foldername_list OUT DBMS_SQL.VARCHAR2_TABLE
);

Parameters

Table 1-10 LIST_TOPLEVEL_SUBDFLDRS parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

foldername_list

The list of subscribed child folder objects under the parent folder



LIST_SUBSCRIBED_FOLDERS Procedure

This procedure returns a list of subscribed child folders, given the parent folder.

Throws Exceptions

mail_errors.unauthenticated_err

Syntax

PROCEDURE list_subscribed_folders (
    session_id IN NUMBER,
    parent_name IN VARCHAR2,
    foldername_list OUT DBMS_SQL.VARCHAR2_TABLE
);
PROCEDURE list_subscribed_folders (
    session_id IN NUMBER,
    parent_obj IN MAIL_FOLDER_OBJ,
    foldername_list OUT DBMS_SQL.VARCHAR2_TABLE
);

Parameters

Table 1-11 LIST_SUBSCRIBED_FOLDERS Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

parent_name

The full path of the parent folder name

parent_obj

The MAIL_FOLDER_OBJ representing the parent folder

foldername_list

The list of subscribed child folder objects under the parent folder



IS_FOLDER_SUBSCRIBED Function

This function tests to see if the folder is subscribed.

Throws Exceptions

mail_errors.unauthenticated_err

Syntax

FUNCTION is_folder_subscribed (
    session_id    IN NUMBER,
    folder_name   IN VARCHAR2
) return BOOLEAN;

Parameters

Table 1-12 IS_FOLDER_SUBSCRIBED parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

folder_name

The full path of the folder name



SUBSCRIBE_FOLDER Procedure

This procedure subscribes the specified folder. Errors are not returned if the folder has already been subscribed.

Throws Exceptions

mail_errors.unauthenticated_err

Syntax

PROCEDURE subscribe_folder (
    session_id    IN NUMBER,
    folder_name   IN VARCHAR2
);

Parameters

Table 1-13 SUBSCRIBE_FOLDER parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

folder_name

The full path of the folder name



UNSUBSCRIBE_FOLDER Procedure

This procedure unsubscribes the specified folder. Errors are not returned if the folder has not been subscribed at the time of the call.

Throws Exceptions

mail_errors.unauthenticated_err

Syntax

PROCEDURE unsubscribe_folder (
    session_id  IN NUMBER,
    folder_name IN VARCHAR2
);

Parameters

Table 1-14 UNSUBSCRIBE_FOLDER Procedure parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

folder_name

The full path of the folder name



HAS_FOLDER_CHILDREN Function

This function tests to see if any child folders exist.

Throws Exception

mail_errors.unauthenticated_err

Syntax

FUNCTION has_folder_children (
    session_id IN NUMBER,
    folder_obj IN MAIL_FOLDER_OBJ
) return BOOLEAN;

Parameters

Table 1-15 HAS_FOLDER_CHILDREN Function parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

folder_obj

The folder object



GET_FOLDER_EXPIRY Procedure

This function returns folder expiry information; specifically, the number of days to keep messages in the folder . A value of 0 means messages will not be automatically removed by the HouseKeeper server.

Throws Exception

mail_errors.unauthenticated_err

Syntax

PROCEDURE get_folder_expiry (    session_id   IN   NUMBER,    folder_name  IN   VARCHAR2,    expiry       OUT  NUMBER);

Parameters

Table 1-16 GET_FOLDER_EXPIRY Function parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

folder_name

The full path of a folder name

expiry

Number of days messages will stay in the folder.



SET_FOLDER_EXPIRY Procedure

This function sets the folder expiry; specifically, the number of days messages in the folder will be kept. A value of 0 means messages will not be automatically removed by the HouseKeeper server.

Throws Exception

mail_errors.unauthenticated_err

Syntax

PROCEDURE get_folder_expiry (    session_id   IN   NUMBER,    folder_name  IN   VARCHAR2,    expiry       OUT  NUMBER);

Parameters

Table 1-17 SET_FOLDER_EXPIRY Function parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

folder_name

The full path of a folder name

expiry

Number of days messages will stay in the folder.



GET_FOLDER_DETAILS Procedure

This procedure returns folder information, such as the folder UIDL identifier, total message count, number of unseen messages, and number of recent messages.

Throws Exceptions

mail_errors.unauthenticated_err

Syntax

PROCEDURE get_folder_details (
    session_id        IN NUMBER,
    folder_obj        IN MAIL_FOLDER_OBJ,
    folder_detail_obj OUT MAIL_FOLDER_DETAIL
);

Parameters

Table 1-18 GET_FOLDER_DETAILS Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

folder_obj

The folder object

folder_detail_obj

A folder detail object that contains information about the folder



CREATE_FOLDER Procedure

This procedure creates a folder on the mail store with the given name, and returns a folder object representing the new folder. When this folder is created, any folders in its path that don't exist are also created. A FOLDER_TYPE_ERR is returned if the parent folder does not allow creation of subfolders.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_already_exists_err

mail_errors.folder_type_err

Syntax

PROCEDURE create_folder (
    session_id    IN NUMBER,
    folder_name   IN VARCHAR2,
    folder_obj    OUT MAIL_FOLDER_OBJ
);

Parameters

Table 1-19 CREATE_FOLDER Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

folder_name

The full path of a folder name

folder_obj

The MAIL_FOLDER_OBJ returned



DELETE_FOLDER Procedure

This procedure deletes the specified folder. If a recursive flag is set to true, all the messages in the folder, all sub-folders and their messages, and the folder itself are removed. A recursive flag set to false performs the following actions:

If no sub-folder exists, the messages in the folder and the folder itself are removed.

If sub-folders exist, the messages in the folder are removed, and the folder is marked as not selectable (the OPEN_FOLDER operation on this folder can fail).

If this procedure is called with a folder that is marked as not selectable and contains a subfolder, the MAIL_ERRORS.FOLDER_TYPE_ERR is thrown. If called with folder that has already marked as \NOSELECT and still contains sub-folder, the MAIL_ERRORS.FOLDER_TYPE_ERR will be thrown.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.operation_not_allowed

mail_errors.folder_type_err

mail_errors.folder_not_found_err

Syntax

PROCEDURE delete_folder (
    session_id    IN NUMBER,
    folder_name   IN VARCHAR2,
    recursive     IN BOOLEAN DEFAULT false
);
PROCEDURE delete_folder (
    session_id   IN NUMBER,
    folder_obj   IN MAIL_FOLDER_OBJ,
    recursive    IN BOOLEAN DEFAULT false
);

Parameters

Table 1-20 DELETE_FOLDER Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

folder_name

The full path of the folder name

folder_obj

The MAIL_FOLDER_OBJ representing the folder

recursive

If set to true, it deletes the folder and any sub-folders



RENAME_FOLDER Procedure

This procedure renames the specified folder and returns the new folder object. If renaming INBOX, all the messages in INBOX are moved to the new folder name, and the INBOX folder will remain with no messages.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_not_found_err

mail_errors.folder_already_exists_err

mail_errors.operation_not_allowed

Syntax

PROCEDURE rename_folder (
    session_id    IN NUMBER,
    folder_name   IN VARCHAR2,
    new_folder_name  IN VARCHAR2,
    folder_obj       OUT MAIL_FOLDER_OBJ
);
PROCEDURE rename_folder (
    session_id    IN NUMBER,
    folder_obj    IN OUT MAIL_FOLDER_OBJ,
    new_folder_name   IN VARCHAR2
);

Parameters

Table 1-21 RENAME_FOLDER Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

folder_name

The full path of the folder name

new_folder_name

The new name for the folder

folder_obj

The MAIL_FOLDER_OBJ representing the folder



OPEN_FOLDER Procedure

This procedure opens the specified folder and returns the folder object. If the folder is marked with the \NOSELECT flag, a mail_errors.folder_type_err will be thrown.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_not_found_err

mail_errors.folder_type_err

Syntax

PROCEDURE open_folder (
    session_id   IN  NUMBER,
    folder_name  IN  VARCHAR2,
    folder_obj   OUT MAIL_FOLDER_OBJ
);

Parameters

Table 1-22 OPEN_FOLDER Procedure

Parameters Description

session_id

An identifier that represents a user's authenticated session

folder_name

The full path of the folder name

folder_obj

The MAIL_FOLDER_OBJ representing the folder



GET_FOLDER_MESSAGES Procedure

This procedure returns all of the messages with the specified message type in the current open folder.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_closed_err

Syntax

PROCEDURE get_folder_messages (
    session_id IN NUMBER,
    message_list OUT MAIL_MESSAGE_LIST,
    message_type IN NUMBER DEFAULT MAIL_MESSAGE.GC_ALL_MAIL
);

Parameters

Table 1-23 GET_FOLDER_MESSAGES Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_list

A list of message objects that belongs to the folder

message_type

The type of message to be retrieved. The default is to retreive all types. The message types are defined in the MAIL_MESSAGE package specification.

Values are:

  • MAIL_MESSAGE.GC_ALL_MAIL

  • MAIL_MESSAGE.GC_EMAIL

  • MAIL_MESSAGE.GC_VOICE_MAIL

  • MAIL_MESSAGE.GC_FAX_MAIL

  • MAIL_MESSAGE.GC_NEWS_MAIL



GET _MESSAGE Procedure

This procedure returns the message object corresponding to the message UID specified in the current open folder.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_closed_err

Syntax

PROCEDURE get _message (
    session_id  IN  NUMBER,
    message_uid IN  NUMBER,
    message_obj OUT MAIL_MESSAGE_OBJ
);

Parameters

Table 1-24 GET_MESSAGE Procedure

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_uid

The message identifier

message_obj

The MAIL_MESSAGE_OBJ type that corresponds to the specified UID



CLOSE_FOLDER Procedure

This procedure closes the current open folder. If the EXPUNGE_FLAG is set to true, all messages in the folder that are marked with the Deleted flag are removed.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_closed_err

Syntax

PROCEDURE close_folder (
    session_id   IN NUMBER,
    expunge_flag IN BOOLEAN
);

Parameters

Table 1-25 CLOSE_FOLDER Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

expunge_flag

A flag indicating whether to expunge the folder before closing



GET_MSG_FLAGS Procedure

This procedure returns message flags belonging to the message list specified in the current open folder.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_closed_err

Syntax

PROCEDURE get_msg_flags (
    session_id IN NUMBER,
    message_list IN MAIL_MESSAGE_LIST,
    message_flags OUT DBMS_SQL.NUMBER_TABLE
);
PROCEDURE get_msg_flags (
    session_id IN NUMBER,
    message_uid_list IN DBMS_SQL.NUMBER_TABLE,
    message_flags OUT DBMS_SQL.NUMBER_TABLE
);
PROCEDURE get_msg_flags (
    session_id        IN  NUMBER,
    message_list      IN  MAIL_MESSAGE_LIST,
    message_flags     OUT DBMS_SQL.NUMBER_TABLE,
    message_usrflags  OUT DBMS_SQL.VARCHAR2_TABLE
);
PROCEDURE get_msg_flags (
    session_id        IN   NUMBER,
    message_uid_list  IN   DBMS_SQL.NUMBER_TABLE,
    message_flags     OUT  DBMS_SQL.NUMBER_TABLE,
    message_usrflags  OUT  DBMS_SQL.VARCHAR2_TABLE
);

Parameters

Table 1-26 GET_MSG_FLAGS Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_list

A list of message objects that belongs to the folder

message_uid_list

A list of message UIDs identifying messages in the folder

message_flags

A list of message flags corresponding to the list of requested messages. Flag values are defined in the MAIL_MESSAGE package specification. Values are:

  • MAIL_MESSAGE.GC_SEEN_FLAG

  • MAIL_MESSAGE.GC_FLAGGED_FLAG

  • MAIL_MESSAGE.GC_ANSWERED_FLAG

  • MAIL_MESSAGE.GC_DELETED_FLAG

  • MAIL_MESSAGE.GC_DRAFT_FLAG

message_usrflags

A list of user-defined flags. They are a list of space-separated user-defined flag strings.



SET_MSG_FLAGS Procedure

This procedure sets or unsets the message flags belonging to the list of messages specified in the current open folder.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_closed_err

Syntax

PROCEDURE set_msg_flags (
    session_id    IN NUMBER,
    message_list  IN MAIL_MESSAGE_LIST,
    flags         IN NUMBER,
    set_flag      IN BOOLEAN
);
PROCEDURE set_msg_flags (
    session_id        IN NUMBER,
    message_uid_list  IN DBMS_SQL.NUMBER_TABLE,
    flags             IN NUMBER,
    set_flag          IN BOOLEAN
);

Parameters

Table 1-27 SET_MSG_FLAGS Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_list

A list of message objects that belongs to the folder

message_uid_list

A list of message UIDs identifying messages in the folder

flags

A list of message flags corresponding to the list of requested messages. Flag values are defined in the MAIL_MESSAGE package specification. Values are:

  • MAIL_MESSAGE.GC_SEEN_FLAG

  • MAIL_MESSAGE.GC_FLAGGED_FLAG

  • MAIL_MESSAGE.GC_ANSWERED_FLAG

  • MAIL_MESSAGE.GC_DELETED_FLAG

  • MAIL_MESSAGE.GC_DRAFT_FLAG

set_flag

If true, sets the value of flags. Otherwise, it unsets the value.



SET_MSG_USRFLAGS Procedure

This procedure toggles user-defined message flags for the specified message object.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_closed_err

Syntax

PROCEDURE set_msg_usrflags (
    session_id       IN NUMBER,
    message_obj      IN MAIL_MESSAGE_OBJ,
    message_usrflags IN VARCHAR2,
    set_flag         IN BOOLEAN
);

Parameters

Table 1-28 SET_MSG_USRFLAGS Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

message_usrflags

User defined message flag string. It contains a list of user defined flag strings separated by space.

set_flag

If true, set the flags specified; otherwise, un-set the flags specified.



DELETE_MESSAGES Procedure

This procedure deletes the list of messages specified in the current open folder. This is equivalent to marking the messages as deleted and performing an expunge operation on the folder.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_closed_err

Syntax

PROCEDURE delete_messages (
    session_id IN NUMBER,
    message_uid_list IN DBMS_SQL.NUMBER_TABLE
);

Parameters

Table 1-29 DELETE_MESSAGES Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_uid_list

A list of message UIDs identifying messages in the folder



EXPUNGE_FOLDER Procedure

This procedure removes all messages in the current open folder if the gc_deleted_flag flag is set.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_closed_err

Syntax

PROCEDURE expunge_folder (
    session_id IN NUMBER,
);

Parameters

Table 1-30 EXPUNGE_FOLDER Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session



IS_FOLDER_OPEN Function

This function tests to see if the folder is the same folder currently selected in the user's session.

Throws Exceptions

mail_errors.unauthenticated_err

Syntax

FUNCTION is_folder_open (
    session_id IN NUMBER,
    folder_obj IN MAIL_FOLDER_OBJ
) return BOOLEAN;

Parameters

Table 1-31 IS_FOLDER_OPEN parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

folder_obj

The folder object



CHECK_NEW_MESSAGES Function

This function tests to see if there are any new messages in the currently selected folder. New messages are messages not seen by the folder since the last GET_NEW_MESSAGES call. When the folder is first opened, the last message considered retrieved is the message last seen by any mail client. After that the last message is changed accordingly by calls to GET_FOLDER_MESSAGE and GET_NEW_MESSAGES.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_closed_err

Syntax

FUNCTION check_new_messages (
    session_id   IN NUMBER,
    message_type IN NUMBER DEFAULT MAIL_MESSAGE.GC_ALL_MAIL
) return BOOLEAN;

Parameters

Table 1-32 CHECK_NEW_MESSAGES Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_type

The type of message to be retrieved. The default is to get all types. The message types are defined in the MAIL_MESSAGE package specification.



CHECK_RECENT_MESSAGES Function

This function tests to see if there are any recent messages in the specified folder. Recent messages are messages that have not been retrieved by any mail client. This procedure can be called on a closed folder.

Throws Exception

mail_errors.unauthenticated_err

mail_errors.folder_not_found_err

Syntax

FUNCTION check_recent_messages (
    session_id    IN NUMBER,
    folder_name   IN VARCHAR2,
    message_type  IN NUMBER DEFAULT MAIL_MESSAGE.GC_ALL_MAIL
) return BOOLEAN;

Parameters

Table 1-33 CHECK_RECENT_MESSAGES Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

folder_name

The full path of the folder name

message_type

The type of message to be retrieved. The default is to retreive all types. Message types are defined in the MAIL_MESSAGE package specification.

Values are:

  • MAIL_MESSAGE.GC_ALL_MAIL

  • MAIL_MESSAGE.GC_EMAIL

  • MAIL_MESSAGE.GC_VOICE_MAIL

  • MAIL_MESSAGE.GC_FAX_MAIL

  • MAIL_MESSAGE.GC_NEWS_MAIL



GET_NEW_MESSAGES Procedure

This procedure returns all the new messages in the currently selected folder. New messages are messages not seen by the folder since last message retrieval. When the folder is first opened, the last message considered retrieved is the last message seen by any mail client after the last message is changed accordingly by calls to GET_FOLDER_MESSAGES and GET_NEW_MESSAGES. If MESSAGE_TYPE is specified, only messages in the specified type are returned.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_closed_err

Syntax

PROCEDURE get_new_messages (
    session_id IN NUMBER,
    message_list OUT MAIL_MESSAGE_LIST,
    message_type IN NUMBER DEFAULT MAIL_MESSAGE.GC_ALL_MAIL
);

Parameters

Table 1-34 GET_NEW_MESSAGES Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_list

A list of new message objects

message_type

The type of message to be retrieved. The default is to retreive all types. Message types are defined in the MAIL_MESSAGE package specification.

Values are:

  • MAIL_MESSAGE.GC_ALL_MAIL

  • MAIL_MESSAGE.GC_EMAIL

  • MAIL_MESSAGE.GC_VOICE_MAIL

  • MAIL_MESSAGE.GC_FAX_MAIL

  • MAIL_MESSAGE.GC_NEWS_MAIL



COPY_MESSAGES Procedure

This procedure copies messages in the currently selected folder to another folder. If the destination folder has the \NOSELECT flag set, the MAIL_ERRORS.FOLDER_TYPE_ERR exception is thrown. If the specified message does not belong to the current open folder, the MAIL_ERRORS.PARAM_PARSE_ERR exception is thrown.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_closed_err

mail_errors.folder_not_found_err

mail_errors.folder_type_err

mail_errors.param_parse_err

Syntax

PROCEDURE copy_messages (
    session_id IN NUMBER,
    message_list IN MAIL_MESSAGE_LIST,
    to_folder_name IN VARCHAR2
);
PROCEDURE copy_messages (
    session_id IN NUMBER,
    message_uid_list IN DBMS_SQL.NUMBER_TABLE,
    to_folder_name IN VARCHAR2
);

Parameters

Table 1-35 COPY_MESSAGES Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_list

A list of message objects

message_uid_list

A list of message UIDs

to_folder_name

The full path of the destination folder name



MOVE_MESSAGES Procedure

This procedure moves messages in the current folder to another folder. If the destination folder is marked with the \NOSELECT flag (meaning it cannot contain messages), the mail_errors.folder_type err is thrown.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_closed_err

mail_errors.folder_not_found_err

mail_errors.folder_type_err

mail_errors.param_parse_err

Syntax

PROCEDURE move_messages (
    session_id     IN NUMBER,
    message_list   IN MAIL_MESSAGE_LIST,
    to_folder_name IN VARCHAR2
);
PROCEDURE move_messages (
    session_id       IN NUMBER,
    message_uid_list IN DBMS_SQL.NUMBER_TABLE,
    to_folder_name   IN VARCHAR2
);
PROCEDURE move_messages (
    session_id       IN NUMBER,
    from_folder_obj  IN MAIL_FOLDER_OBJECT,
    message_uid_list INDBMS_SQL.NUMBER_TABLE,
    to_folder_name   IN VARCHAR2
);

Parameters

Table 1-36 MOVE_MESSAGES Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_list

A list of message objects

message_uid_list

A list of message UIDs

from_folder_name

The MAIL_FOLDER_OBJ representing the source folder.

to_folder_name

The full path of the destination folder name



IS_FOLDER_MODIFIED Function

This function tests to see if any messages in the currently selected folder have been modified from another session. A folder is modified if any changes in message flags or deletion of messages were made in the folder by another client or session. If the folder was modified, users have to re-issue the GET_NEW_MESSAGES procedure to be synchronized with the mail store.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_closed_err

Syntax

FUNCTION is_folder_modified (
    session_id IN NUMBER
);

Parameters

Table 1-37 IS_FOLDER_MODIFIED Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session



SORT_FOLDER Procedure

This procedure sorts the folder given the sort criteria and returns an ordered list of message UIDs.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.param_parse_err

Syntax

PROCEDURE sort_folder (
    session_id IN NUMBER,
    folder_obj IN MAIL_FOLDER_OBJ,
    sort_criteria IN MAIL_SORT_CRITERIA,
    message_uid_list OUT DBMS_SQL.NUMBER_TABLE
);
PROCEDURE sort_folder (
    session_id IN NUMBER,
    folder_obj IN MAIL_FOLDER_OBJ,
    sort_criteria IN MAIL_SORT_CRITERIA,
    message_list OUT MAIL_MESSAGE_LIST);
};      

Parameters

Table 1-38 SORT_FOLDER Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

folder_obj

The MAIL_FOLDER_OBJ representing the folder

sort_criteria

A list of sort criteria

Values are:

  • Subject

  • Cc

  • From

  • Date

  • Internal_date

  • Size

message_list

An ordered list of message objects

message_uid_list

An ordered list of message UIDs



SEARCH_FOLDER Procedure

This procedure searches the folder and returns a list of message objects that meet the specified criteria. The format of the search criteria is the same as the format in the IMAP4 protocol [RFC 2060], except when specifying to search within a set of messages, the set is passed in as a parameter.

Examples:

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.param_parse_err

Syntax

PROCEDURE search_folder (
    session_id IN NUMBER,
    folder_obj IN MAIL_FOLDER_OBJ,
    search_criteria IN VARCHAR2,
    message _list OUT MAIL_MESSAGE_LIST
);
PROCEDURE search_folder (
    session_id IN NUMBER,
    folder_obj IN MAIL_FOLDER_OBJ,
    search_criteria IN VARCHAR2,
    in_message_list IN MAIL_MESSAGE_LIST,
    message_list OUT MAIL_MESSAGE_LIST
);

Parameters

Table 1-39 SEARCH_FOLDER Parameters

Parameters Description

session_id

An identifier that represents a user's authenticated session

folder_obj

The MAIL_FOLDER_OBJ representing the folder

search_criteria

A list of search criterion per IMAP4 standard

in_message_list

A list of message objects to search from

message_list

The list of message objects that meets the search criteria



MAIL_MESSAGE Package

The MAIL_MESSAGE package provides message retrieval, message composition, and Oracle Text related functionality. The validity of the session is checked before performing any operation, except for composing send operations. Users can only compose one message at a time, and a MSG_COMPOSE_LIMIT_ERR is thrown if a violation occurs.

The MAIL_MESSAGE package contains the following procedures:


GET_MESSAGE_OBJ Procedure

This procedure returns a message object given the message UID in the current open folder.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_closed_err

Syntax

PROCEDURE get_message_obj (
    session_id  IN NUMBER,
    message_uid IN NUMBER,
    message_obj OUT MAIL_MESSAGE_OBJ);

Parameters

Table 1-40 GET_MESSAGE_OBJ Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_uid

The message UID

message_obj

The MAIL_MESSAGE_OBJ returned



GET_INCLUDED_MESSAGE Procedure

This procedure returns a message object representing the included message. The message type of the specified message or body-part object must be of "message" type; otherwise the MAIL_ERRORS.PARAM_PARSE_ERR exception is thrown.

Throws Exception

mail_errors.unauthenticated_err

mail_errors.param_parse_err

mail_errors.bad_message_var

mail_errors.bad_msgpart_var

Syntax

PROCEDURE get_included_message (
    session_id  IN NUMBER,
    message_obj IN MAIL_MESSAGE_OBJ,
    message_obj OUT MAIL_MESSAGE_OBJ);
PROCEDURE get_included_message (
    session_id   IN NUMBER,
    bodypart_obj IN MAIL_BODYPART_OBJ,
    message_obj  IN MAIL_MESSAGE_OBJ,
);

Parameters

Table 1-41 GET_INCLUDED_MESSAGE Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object with message Content-Type

bodypart_obj

The body-part object with message Content-Type

incl_message_obj

The MAIL_MESSAGE_OBJ returned



GET_HEADER Procedure

This procedure returns the corresponding header value given in the header prompt.

If a message object is passed in, the header value refers to the top-level message header.

If a body-part object is passed in, the header value refers to that specific body-part header.

When the header prompt is not found in the headers, a null value is returned. When the returned value is a VARCHAR2 type, it is truncated to a maximum length of 2000. If there are multiple headers with the same prompt, the returned value is the first header. When the returned value is a MAIL_HEADER_LIST object list, all headers with the specified prompt name are returned.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.bad_message_var

mail_errors.bad_msgpart_var

Syntax

PROCEDURE get_header (
    session_id    IN NUMBER,
    message_obj   IN MAIL_MESSAGE_OBJ,
    header_prompt IN VARCHAR2,
    header_value  OUT VARCHAR2);
PROCEDURE get_header (
    session_id    IN NUMBER,
    bodypart_obj  IN MAIL_BODYPART_OBJ,
    header_prompt IN VARCHAR2,
    header_value  OUT VARCHAR2);
PROCEDURE get_header (
    session_id    IN NUMBER,
    message_obj   IN MAIL_MESSAGE_OBJ,
    header_list   OUT MAIL_HEADER_LIST);
PROCEDURE get_header (
    session_id    IN NUMBER,
    bodypart_obj  IN MAIL_BODYPART_OBJ,
    header_list   OUT MAIL_HEADER_LIST);

Parameters

Table 1-42 GET_HEADER Parameters

Parameters Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

bodypart_obj

The body-part object

header_prompt

The message header

header_value

The corresponding header value

header_list

A list of header objects with the specified prompt



GET_HEADERS Procedure

This procedure returns all of the header values of the given message part. If a message object is passed in, the header value refers to the top-level message header.

If a body-part object is passed in, the header value is referred to that specific body-part header.

When the returned value is a dbms_sql.varchar2_table type, all header values are truncated to 2000 in length if the length of the value is longer than 2000. When the headers are returned in a MAIL_HEADER_LIST object list, each name and value pair is represented by a MAIL_HEADER_OBJ object.

Throws Exception

mail_errors.unauthenticated_err

mail_errors.bad_message_var

mail_errors.bad_msgpart_var

Syntax

PROCEDURE get_headers (
    session_id     IN NUMBER,
    message_obj    IN MAIL_MESSAGE_OBJ,
    header_prompts IN dbms_sql.varchar2_table,
    header_values  OUT dbms_sql.varchar2_table);
PROCEDURE get_headers (
    session_id     IN NUMBER,
    bodypart_obj   IN MAIL_BODYPART_OBJ,
    header_prompts IN dbms_sql.varchar2_table,
    header_values  OUT dbms_sql.varchar2_table);
PROCEDURE get_headers (
    session_id     IN NUMBER,
    message_obj    IN MAIL_MESSAGE_OBJ,
    header_list    OUT MAIL_HEADER_LIST);
PROCEDURE get_headers (
    session_id     IN NUMBER,
    bodypart_obj   IN MAIL_BODYPART_OBJ,
    header_list    OUT MAIL_HEADER_LIST);

Parameters

Table 1-43 GET_HEADERS Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

bodypart_obj

The body-part object

header_prompts

An array of header names belonging to this part

header_values

An array of corresponding header values

header_list

A list of header objects belonging to this part



GET_CONTENT_TYPE Procedure

This procedure is used to obtain the Content-Type header value. It internally calls the GET_HEADER procedure with the specific header prompt.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.bad_message_var

mail_errors.bad_msgpart_var

Syntax

PROCEDURE get_content_type (
    session_id    IN NUMBER,
    message_obj   IN MAIL_MESSAGE_OBJ,
    content_type  OUT VARCHAR2);
PROCEDURE get_content_type (
    session_id    IN NUMBER,
    bodypart_obj  IN MAIL_BODYPART_OBJ,
    content_type  OUT VARCHAR2);

Parameters

Table 1-44 GET_CONTENT_TYPE Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

bodypart_obj

The body-part object

content_type

The Content-Type header value



GET_REPLY_TO Procedure

This procedure is used to obtain the Reply-To header value. It internally calls the GET_HEADER procedure with the specific header prompt.

Throws Exception

mail_errors.unauthenticated_err

mail_errors.bad_message_var

mail_errors.bad_msgpart_var

Syntax

PROCEDURE get_reply_to (
    session_id  IN NUMBER,
    message_obj IN MAIL_MESSAGE_OBJ,
    replyTo_str OUT VARCHAR2);

Parameters

Table 1-45 GET_REPLY_TO Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

replyTo_str

The Reply-To header value



GET_SENT_DATE Procedure

This procedure is used to obtain the Date header value. It internally calls the GET_HEADER procedure with the specific header prompt.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.bad_message_var

mail_errors.bad_msgpart_var

Syntax

PROCEDURE get_sent_date (
    session_id IN NUMBER,
    message_obj IN MAIL_MESSAGE_OBJ,
    sent_date OUT VARCHAR2);

Parameters

Table 1-46 GET_SENT_DATE Parameters

Parameters Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

sent_date

The Date header value



GET_SUBJECT Procedure

This procedure is used to obtain the Subject header value. It internally calls the GET_HEADER procedure with the specific header prompt.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.bad_message_var

mail_errors.bad_msgpart_var

Syntax

PROCEDURE get_subject (
    session_id IN NUMBER,
    message_obj IN MAIL_MESSAGE_OBJ,
    subject_str OUT VARCHAR2);

Parameters

Table 1-47 GET_SUBJECT Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

subject_str

The subject header value



GET_FROM Procedure

This procedure is used to obtain the From header value. It internally calls the GET_HEADER procedure with the specific header prompt.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.bad_message_var

mail_errors.bad_msgpart_var

Syntax

PROCEDURE get_from (
    session_id IN NUMBER,
    message_obj IN MAIL_MESSAGE_OBJ,
    from_str OUT VARCHAR2);

Parameters

Table 1-48 GET_FROM Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

from_str

The From header value



GET_MESSAGEID Procedure

This procedure is used to obtain the Message-ID header value. It internally calls the GET_HEADER procedure with the specific header prompt.

Throws Exception

mail_errors.unauthenticated_err

mail_errors.bad_message_var

mail_errors.bad_msgpart_var

Syntax

PROCEDURE get_messageID (
    session_id IN NUMBER,
    message_obj IN MAIL_MESSAGE_OBJ,
    messageID_str OUT VARCHAR2);

Parameters

Table 1-49 GET_MESSAGEID Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

messageID_str

The Message-ID header value



GET_CONTENTID Procedure

This procedure is used to obtain the Content-ID header value. It internally calls the GET_HEADER procedure with the specific header prompt.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.bad_message_var

mail_errors.bad_msgpart_var

Syntax

PROCEDURE get_contentID (
    session_id IN NUMBER,
    bodypart_obj IN MAIL_BODYPART_OBJ,
    contentID_str OUT VARCHAR2);

Parameters

Table 1-50 GET_CONTENTID Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

bodypart_obj

The body-part object

contentID_str

The Content-ID header value



GET_CONTENTLANG Procedure

This procedure is used to obtain the Content-Language header value. It internally calls the GET_HEADER procedure with the specific header prompt.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.bad_message_var

mail_errors.bad_msgpart_var

Syntax

PROCEDURE get_contentLang (
    session_id IN NUMBER,
    bodypart_obj IN MAIL_BODYPART_OBJ,
    language OUT VARCHAR2);

Parameters

Table 1-51 GET_CONTENTLANG Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

bodypart_obj

The body-part object

language

The Content-Language header value



GET_CONTENTMD5 Procedure

This procedure is used to obtain the Content-MD5 header value. It internally calls the GET_HEADER procedure with the specific header prompt.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.bad_message_var

mail_errors.bad_msgpart_var

Syntax

PROCEDURE get_contentMD5 (
    session_id   IN NUMBER,
    bodypart_obj IN MAIL_BODYPART_OBJ,
    md5          OUT VARCHAR2);

Parameters

Table 1-52 GET_CONTENTMD5 Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

bodypart_obj

The body-part object

md5

The Content-MD5 header value



GET_CHARSET Procedure

This procedure is used to obtain the Content-Type header value, and extract the CHARSET attribute value. It internally calls the GET_HEADER procedure with the specific header prompt.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.bad_message_var

mail_errors.bad_msgpart_var

Syntax

PROCEDURE get_charset (
    session_id   IN NUMBER,
    bodypart_obj IN MAIL_BODYPART_OBJ,
    charset      OUT VARCHAR2);

Parameters

Table 1-53 GET_CHARSET Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

bodypart_obj

The body-part object

charset

The character set attribute value



GET_CONTENTDISP Procedure

This procedure is used to obtain the Content-Disposition header value. It internally calls the GET_HEADER procedure with the specific header prompt.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.bad_message_var

mail_errors.bad_msgpart_var

Syntax

PROCEDURE get_contentDisp (
    session_id   IN NUMBER,
    bodypart_obj IN MAIL_BODYPART_OBJ,
    disposition  OUT VARCHAR2);

Parameters

Table 1-54 GET_CONTENTDISP Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

bodypart_obj

The body-part object

disposition

The Content-Disposition header value



GET_ENCODING Procedure

This procedure is used to obtain the Content-Transfer-Encoding header value. It internally calls the GET_HEADER procedure with the specific header prompt.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.bad_message_var

mail_errors.bad_msgpart_var

Syntax

PROCEDURE get_encoding (
    session_id  IN NUMBER,
    message_obj IN MAIL_MESSAGE_OBJ,
    encoding    OUT VARCHAR2);
PROCEDURE get_encoding (
    session_id   IN NUMBER,
    bodypart_obj IN MAIL_BODYPART_OBJ,
    encoding     OUT VARCHAR2);

Parameters

Table 1-55 GET_ENCODING Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

bodypart_obj

The body-part object

encoding

The Content-Transfer-Encoding header value



GET_CONTENT_FILENAME Procedure

This procedure is used to obtain the Content-Disposition header value and extract the filename attribute value. It internally calls the GET_HEADER procedure with the specific header prompt.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.bad_message_var

mail_errors.bad_msgpart_var

Syntax

PROCEDURE get_content_filename (
    session_id   IN NUMBER,
    bodypart_obj IN MAIL_BODYPART_OBJ,
    filename     OUT VARCHAR2);

Parameters

Table 1-56 GET_CONTENT_FILENAME Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

bodypart_obj

The body-part object

filename

The filename attribute value



GET_MSG_SIZE Procedure

This procedure returns the message size.

Throws Exceptions

mail_errors.unauthenticated_err

Syntax

PROCEDURE get_msg_id (
    session_id   IN NUMBER,
    message_obj  IN MAIL_MESSAGE_OBJ,
    message_size OUT NUMBER);

Parameters

Table 1-57 GET_MSG_SIZE Parameters

Parameters Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

message_size

The message size



GET_RCVD_DATE Procedure

This procedure is used to obtain the time the message is received at the mail store.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.bad_message_var

mail_errors.bad_msgpart_var

Syntax

PROCEDURE get_rcvd_date (
    session_id  IN NUMBER,
    message_obj IN MAIL_MESSAGE_OBJ,
    date_format IN VARCHAR2,
    date_str    OUT VARCHAR2);
PROCEDURE get_rcvd_date (
    session_id    IN NUMBER,
    message_obj   IN MAIL_MESSAGE_OBJ,
    received_date OUT DATE);

Parameters

Table 1-58 GET_RCVD_DATE Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

date_format

The date to string format

date_str

The received date in the string format specified

received_date

The received date in Oracle date format



GET_BODYPART_SIZE Procedure

This procedure returns the size of the body-part.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.bad_message_var

Syntax

PROCEDURE get_bodypart_size (
    session_id IN NUMBER,
    bodypart_obj IN MAIL_BODYPART_OBJ,
    bodypart_size OUT NUMBER);

Parameters

Table 1-59 GET_BODYPART_SIZE Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

bodypart_obj

The body-part object

bodypart_size

The body-part size



GET_CONTENT_LINECOUNT Procedure

This procedure returns the line count of the body-part.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.bad_message_var

Syntax

PROCEDURE get_content_linecount (
    session_id   IN NUMBER,
    bodypart_obj IN MAIL_BODYPART_OBJ,
    line_count   OUT NUMBER);

Parameters

Table 1-60 GET_CONTENT_LINECOUNT Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

bodypart_obj

The body-part object

line_count

The total number of lines in the body-part



GET_MULTIPART_BODYPARTS Procedure

This procedure returns a list of body-parts that belong to the specified multipart message or body-part. If the message or body-part object passed in is not of a multipart MIME type, a PARAM_PARSE_ERR exception is raised.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.param_parse_err

mail_errors.bad_message_var

Syntax

PROCEDURE get_multipart_bodyparts (
    session_id IN NUMBER,
    message_obj IN MAIL_MESSAGE_OBJ,
    bodypart_list OUT MAIL_BODYPART_LIST);
PROCEDURE get_multipart_bodyparts (
    session_id IN NUMBER,
    bodypart_obj IN MAIL_BODYPART_OBJ,
    bodypart_list OUT MAIL_BODYPART_LIST);

Parameters

Table 1-61 GET_MULTIPART_BODYPARTS Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

bodypart_obj

The body-part object

bodypart_list

A list of body-parts



GET_MSG Procedure

This procedure returns a BLOB locator to the entire encoded message. Storage does not needs to be allocated beforehand.

Throws Exceptions

mail_errors.unauthenticated_err

Syntax

PROCEDURE get_msg (
    session_id IN NUMBER,
    message_obj IN MAIL_MESSAGE_OBJ,
    message_source OUT BLOB);

Parameters

Table 1-62 GET_MSG Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

message_source

The whole message content in its original encoded form



GET_MSG_BODY Procedure

This procedure copies the message body into the specified BLOB locator. The locator must have enough storage for the data. If the message is not a simple MIME type, no data is returned. If the message body's Content-Transfer-Encoding header specifies that the data is encoded, using base64 or quoted-printable encodings, the content is decoded before returning.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.bad_message_var

Syntax

PROCEDURE get_msg_body (
    session_id IN NUMBER,
    message_obj IN MAIL_MESSAGE_OBJ,
    content OUT BLOB);

Parameters

Table 1-63 GET_MSG_BODY Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

content

The entire decoded message content



GET_BODYPART_CONTENT Procedure

This procedure copies the content of the body-part into the specified BLOB locator. If the body-part object is not a simple MIME type, no data is returned. If the body-part's Content-Transfer-Encoding header specifies that the data is encoded, using base64 or quoted-printable encodings, the content is decoded before returning.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.bad_message_var

Syntax

PROCEDURE get_bodypart_content (
    session_id IN NUMBER,
    bodypart_obj IN MAIL_BODYPART_OBJ,
    content OUT BLOB);

Parameters

Table 1-64 GET_BODYPART_CONTENT

Parameter Description

session_id

An identifier that represents a user's authenticated session

bodypart_obj

The body-part object

content

The entire decoded message content



GET_MSG_FLAGS Procedure

This procedure returns the flags associated with a message.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_closed_err

Syntax

PROCEDURE get_msg_flags (
    session_id IN NUMBER,
    message_obj IN MAIL_MESSAGE_OBJ,
    message_flags OUT NUMBER);
PROCEDURE get_msg_flags (
    session_id        IN NUMBER,
    message_obj       IN MAIL_MESSAGE_OBJ,
    message_flags     OUT NUMBER,
    message_usrflags  OUT VARCHAR2
);

Parameters

Table 1-65 GET_MSG_FLAGS Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

A message object

message_flags

The message flags are a set of well-defined bit-wise values. The bits are defined in the MAIL_MESSAGE package specification.

message_usrflags

User defined message flag string. It contains a list of user defined flag strings separated by spaces.



SET_MSG_FLAGS Procedure

This procedure sets and unsets the message flags for the specified message object.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_closed_err

Syntax

PROCEDURE set_msg_flags (
    session_id    IN NUMBER,
    message_obj   IN MAIL_MESSAGE_OBJ,
    message_flags IN NUMBER,
    set_flag      IN BOOLEAN);

Parameters

Table 1-66 SET_MSG_FLAGS Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

A message object

message_flags

The message flags are a set of well-defined bit-wise values. The bits are defined in the MAIL_MESSAGE package specification.

set_flag

If true, sets the specified flags, otherwise, unsets the specified flags



GET_AUTH_INFO Procedure

This procedure returns authenticated user information, if available. The authenticated user information is stored when a user authenticates before sending an e-mail.

Throws Exceptions

mail_errors.unauthenticated_err

Syntax

PROCEDURE get_auth_info (
    session_id  IN NUMBER,
    message_obj IN MAIL_MESSAGE_OBJ,
    auth_info   OUT VARCHAR2);

Parameters

Table 1-67 GET_AUTH_INFO Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

auth_info

The authenticated user information



GET_MSG_COMMENT Procedure

A comment is a name-value pair. If the specified comment name is set for the message, this procedure returns the comment value.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_closed_err

Syntax

PROCEDURE get_msg_comment (
    session_id       IN NUMBER,
    message_obj      IN MAIL_MESSAGE_OBJ,
    comment_name     IN VARCHAR2,
    comment_value    OUT VARCHAR2
);

Parameters

Table 1-68 GET_MSG_COMMENT Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

comment_name

The name of the comment.

comment_value

The returned value of the comment.



SET_MSG_COMMENT Procedure

A comment is a name-value pair. If the specified comment name is set for the message, this procedure returns the comment value.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_closed_err

Syntax

PROCEDURE set_msg_comment (
    session_id       IN NUMBER,
    message_obj      IN MAIL_MESSAGE_OBJ,
    comment_name     IN VARCHAR2,
    comment_value    IN VARCHAR2
);

Parameters

Table 1-69 SET_MSG_COMMENT Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

comment_name

The name of the comment.

comment_value

The new value of the comment.



SET_MSG_COMMENTS Procedure

This procedure sets a list of comments (name-value pairs) for the message.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_closed_err

Syntax

PROCEDURE set_msg_comments (
    session_id       IN NUMBER,
    message_obj      IN MAIL_MESSAGE_OBJ,
    comment_names    IN dbms_sql.varchar2_table,
    comment_values   IN dbms_sql.varchar2_table
);

Parameters

Table 1-70 SET_MSG_COMMENTS Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

comment_name

The names of the comment.

comment_value

The new values of the comments.



REMOVE_MSG_COMMENT Procedure

This procedure removes a message comment (a name-value pair) given the comment name.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_closed_err

Syntax

PROCEDURE remove_msg_comment (
    session_id       IN NUMBER,
    message_obj      IN MAIL_MESSAGE_OBJ,
    comment_name     IN VARCHAR2,
);

Parameters

Table 1-71 REMOVE_MSG_COMMENT Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

comment_name

The name of the comment to remove



REMOVE_MSG_COMMENTS Procedure

This procedure removes a list of message comments (name-value pairs) given the comment names.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.folder_closed_err

Syntax

PROCEDURE remove_msg_comments (
    session_id       IN NUMBER,
    message_obj      IN MAIL_MESSAGE_OBJ,
    comment_names    IN dbms_sql.varchar2_table,
);

Parameters

Table 1-72 REMOVE_MSG_COMMENTS Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

comment_name

The names of the comments to delete



COMPOSE_MESSAGE Procedure

This procedure initializes a message composition. There can be at most one message in composition at any given time.

Throws Exceptions

mail_errors.msg_compose_limit_err

mail_errors.param_parse_err

Syntax

PROCEDURE compose_message (
    message_obj OUT MAIL_MESSAGE_OBJ);

Parameters

Table 1-73 COMPOSE_MESSAGE Parameters

Parameter Description

message_obj

A message object



SET_MSGHEADER Procedure

This procedure sets a list of common message headers. If null is specified, the header is not included. If the sent date is null, it is set to the current time.

Throws Exceptions

mail_errors.msg_compose_limit_err

Syntax

PROCEDURE set_msgheader (
    message_obj IN MAIL_MESSAGE_OBJ,
    to_str IN VARCHAR2,
    from_str IN VARCHAR2,
    cc_str IN VARCHAR2 DEFAULT null,
    replyto_str IN VARCHAR2 DEFAULT null,
    sent_date IN DATE DEFAULT null,
    subject_str IN VARCHAR2 DEFAULT null,
    mime_version IN VARCHAR2 DEFAULT '1.0',
    content_type IN VARCHAR2 DEFAULT 'text/plain',
    charset IN VARCHAR2 DEFAULT 'us-ascii',
    encoding IN VARCHAR2 DEFAULT '8bit');

Parameters

Table 1-74 SET_MSGHEADER Parameters

Parameter Description

message_obj

A message object

to_str

The To RFC822 header

from_str

The From RFC822 header

cc_str

The Cc RFC822 header

replyto_str

The Reply-to RFC822 header

sent_date

The Date RFC822 header

subject_str

The Subject RFC822 header

mime_version

The MIME-Version RFC822 header

content_type

The Content-Type RFC822 header

charset

The Content-Type RFC822 header charset attribute

encoding

The Content-Transfer-Encoding RFC822 header



SET_BPHEADER Procedure

This procedure sets a list of common body-part headers. If null is specified, the header is not included. All header values are limited to 2000 in length; if it exceeds the limit, a MAIL_ERRORS.PARAM_PARSE_ERR is thrown.

Throws Exceptions

mail_errors.msg_compose_limit_err

mail_errors.param_parse_err

Syntax

PROCEDURE set_bpheader (
    bodypart_obj IN MAIL_BODYPART_OBJ,
    content_type IN VARCHAR2 DEFAULT 'text/plain',
    charset      IN VARCHAR2 DEFAULT 'us-ascii',
    encoding     IN VARCHAR2 DEFAULT '8bit',
    contentID    IN VARCHAR2 DEFAULT null,
    language     IN VARCHAR2 DEFAULT null,
    contentMD5   IN VARCHAR2 DEFAULT null,
    description  IN VARCHAR2 DEFAULT null,
    disposition  IN VARCHAR2 DEFAULT 'inline',
    filename     IN VARCHAR2 DEFAULT null);

Parameters

Table 1-75 SET_BPHEADER Parameters

Parameter Description

message_obj

A message object

content_type

The Content-Type header

charset

The Content-Type header charset attribute

encoding

The Content-Transfer-Encoding header

contentID

The Content-ID header

language

The Content-Language header

contentMD5

The Content-MD5 header

description

The Content-Description header

disposition

The Content-Disposition header

filename

The Content-Disposition header filename attribute



SET_HEADER Procedure

This procedure sets the header value, given the header prompt. This does not override any previous headers; it adds to them. All header values are limited to 2000 in length; if it exceeds the limit, a MAIL_ERRORS.PARAM_PARSE_ERR is thrown.

Throws Exceptions

mail_errors.msg_compose_limit_err

mail_errors.param_parse_err

Syntax

PROCEDURE set_header (
    message_obj IN MAIL_MESSAGE_OBJ,
    header_prompt IN VARCHAR2,
    header_value IN VARCHAR2);
PROCEDURE set_header (
    bodypart_obj IN MAIL_BODYPART_OBJ,
    header_prompt IN VARCHAR2,
    header_value IN VARCHAR2);

Parameters

Table 1-76 SET_HEADER Parameters

Parameter Description

message_obj

The message object

bodypart_obj

The body-part object

header_prompt

The message or body-part header

header_value

The corresponding header value



ADD_BODYPART Procedure

This procedure adds a child body-part to the specified parent message or body-part of Content-Type multipart. If the parent message or body-part object does not have "message" content-type, a PARAM_PARSE_ERR exception is thrown.

Throws Exceptions

mail_errors.msg_compose_limit_err

mail_errors.param_parse_err

Syntax

PROCEDURE add_bodypart (
    parent_message_obj IN MAIL_MESSAGE_OBJ,
    bodypart_obj OUT MAIL_BODYPART_OBJ);
PROCEDURE add_bodypart (
    parent_bodypart_obj IN MAIL_BODYPART_OBJ,
    bodypart_obj OUT MAIL_BODYPART_OBJ);

Parameters

Table 1-77 ADD_BODYPART Parameters

Parameter Description

parent_message_obj

The parent message object

parent_bodypart_obj

The parent body-part object

bodypart_obj

The new child body-part object returned



ADD_INCLMSG_BODYPART Procedure

This procedure adds a new included message to the specified parent message or body-part of Content-Type message. If the parent message or body-part object does not have "message" content-type, a PARAM_PARSE_ERR exception is thrown.

Throws Exceptions

mail_errors.msg_compose_limit_err

mail_errors.param_parse_err

Syntax

PROCEDURE add_inclmsg_bodypart (
    parent_message_obj IN MAIL_MESSAGE_OBJ,
    message_obj        OUT MAIL_MESSAGE_OBJ);
PROCEDURE add_inclmsg_bodypart (
    parent_bodypart_obj IN MAIL_BODYPART_OBJ,
    message_obj         OUT MAIL_MESSAGE_OBJ);

Parameters

Table 1-78 ADD_INCLMSG_BODYPART Parameters

Parameter Description

parent_message_obj

The parent message object

parent_bodypart_obj

The parent body-part object

message_obj

The new included message object returned



SET_INCLMSG_BODYPART Procedure

This procedure sets an included message to the specified parent message or body-part of Content-Type message. The included message must already exist in the mail store. If the parent message or body-part object does not have "message" content-type, a PARAM_PARSE_ERR exception is thrown.

Throws Exceptions

mail_errors.msg_compose_limit_err

mail_errors.param_parse_err

Syntax

PROCEDURE set_inclmsg_bodypart (
    parent_message_obj IN MAIL_MESSAGE_OBJ,
    message_obj        IN MAIL_MESSAGE_OBJ);
PROCEDURE set_inclmsg_bodypart (
    parent_bodypart_obj IN MAIL_BODYPART_OBJ,
    message_obj         IN MAIL_MESSAGE_OBJ);

Parameters

Table 1-79 SET_INCLMSG_BODYPART

Parameter Description

parent_message_obj

The parent message object

parent_bodypart_obj

The parent body-part object

message_obj

An existing message in mail store



SET_CONTENT Procedure

This procedure sets the message or body-part content for the message in the composition. If the message or body-part is not a simple MIME type, a PARAM_PARSE_ERR is thrown. This procedure can be called multiple times. The data is connected together. The data should be in decoded form. When the composed message is sent or appended, the data is encoded according to the Content-Transfer-Encoding header specified for this part of the data.

Throws Exceptions

mail_errors.msg_compose_limit_err

mail_errors.param_parse_err

Syntax

PROCEDURE set_content (
    message_obj IN MAIL_MESSAGE_OBJ,
    content IN RAW);
PROCEDURE set_content (
    message_obj IN MAIL_MESSAGE_OBJ,
    content IN BLOB);
PROCEDURE set_content (
    bodypart_obj IN MAIL_BODYPART_OBJ,
    content IN RAW);
PROCEDURE set_content (
    bodypart_obj IN MAIL_BODYPART_OBJ,
    content IN BLOB);

Parameters

Table 1-80 SET_CONTENT Parameters

Parameter Description

message_obj

The message object

bodypart_obj

The body-part object

content

The message or body-part content



SEND_MESSAGE Procedure

This procedure sends the message currently in composition. The message can also be sent encrypted, signed, or both.

Throws Exceptions

mail_errors.msg_compose_limit_err

mail_errors.smime_err

Syntax

PROCEDURE send_message (
    message_obj IN MAIL_MESSAGE_OBJ);
PROCEDURE send_message (
    message_obj       IN MAIL_MESSAGE_OBJ,
    ceritificate      IN RAW,
    private_key       IN RAW,
    recipients        IN MAIL_MESSAGE.RAW_TABLE,
    inclOrigCert      IN BOOLEAN,
    inclOrigAsRecip   IN BOOLEAN,
    digest_algorithm  IN BINARY_INTEGER,
    sign_algorithm    IN BINARY_INTEGER,
    encrypt_algorithm IN BINARY_INTEGER,
    send_option       IN NUMBER);

Parameters

Table 1-81 SEND_MESSAGE Parameters

Parameter Description

message_obj

The message object

certificate

The user's certificate

private_key

The user's private key

recipients

The recipient's certificates

inclOrigCert

Specifies whether to include the user's certificate when encrypting, signing, or both

inclOrigAsRecip

Specifies whether to include the user's certificate in the recipient list

digest_algorithm

The algorithm to use for generating the digest when signing. It is not used if the message is only being encrypted

Values are:

  • MAIL_MESSAGE.GC_MD5

  • MAIL_MESSAGE.GC_SHA1



APPEND_MESSAGE Procedure

This procedure appends the current message composition to the specified folder. The user must be authenticated and the folder must belong to the user.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.msg_compose_limit_err

Syntax

PROCEDURE append_message (
    session_id IN NUMBER,
    message_obj IN MAIL_MESSAGE_OBJ,
    folder_name IN VARCHAR2,
    received_date IN DATE DEFAUL null,
    message_flags IN NUMBER DEFAULT 0);
PROCEDURE append_message (
    session_id IN NUMBER,
    message_obj IN MAIL_MESSAGE_OBJ,
    folder_obj IN MAIL_FOLDER_OBJ,
    received_date IN DATE DEFAUL null,
    message_flags IN NUMBER DEFAULT 0);

Parameters

Table 1-82 APPEND_MESSAGE Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

folder_name

The folder to which the message is appended

folder_obj

The folder to which the message is appended

received_date

The message's received date

message_flags

A list of message flags corresponding to the list of requested messages. Flag values are defined in the MAIL_MESSAGE package specification.

Values are:

  • MAIL_MESSAGE.GC_SEEN_FLAG

  • MAIL_MESSAGE.GC_FLAGGED_FLAG

  • MAIL_MESSAGE.GC_ANSWERED_FLAG

  • MAIL_MESSAGE.GC_DELETED_FLAG

  • MAIL_MESSAGE.GC_DRAFT_FLAG



ABORT_MESSAGE Procedure

This procedure aborts the current message in composition, and cleans up current message information. This procedure should be called for any errors during message composition.

Syntax

PROCEDURE abort_message;

ENCODE_HDRTEXT Function

This utility function can be used to encode a non-ASCII string into an RFC2047 formatted header string. If the string passed in is ASCII, the function returns the string as is.

Throws Exceptions

mail_errors.msg_compose_limit_err

Syntax

FUNCTION encode_hdrtext (
    p_string IN VARCHAR2
) RETURNS VARCHAR2;

Parameters

Table 1-83 ENCODE_HDRTEXT Parameters

Parameter Description

p_string

A header string



DECRYPT_MESSAGE Procedure

This procedure decrypts a S/MIME message and returns a list of body-parts that belongs to the encrypted part.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.smime_err

Syntax

PROCEDURE decrypt_message (
    session_id IN NUMBER,
    message_obj IN MAIL_MESSAGE_OBJ,
    ceritificate IN RAW,
    private_key IN RAW,
    bodypart_list OUT MAIL_BODYPART_LIST
);
PROCEDURE decrypt_message (
    session_id IN NUMBER,
    bodypart_obj IN MAIL_MESSAGE_OBJ,
    ceritificate IN RAW,
    private_key IN RAW,
    bodypart_list OUT MAIL_BODYPART_LIST
);

Parameters

Table 1-84 DECRYPT_MESSAGE Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

bodypart_obj

The body-part message

certificate

The user's certificate

private_key

The user's private key

bodypart_list

The decrypted body-part list



VERIFY_MESSAGE Procedure

This procedure verifies a digitally signed message.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.smime_err

Syntax

PROCEDURE verify_message (
    session_id IN NUMBER,
    ceritificate IN RAW,
    private_key IN RAW,
    original_content IN BLOB,
    certificate_list IN ES_CERT_LIST,
    signature IN BLOB,
    returned_content OUT BLOB
);

Parameters

Table 1-85 VERIFY_MESSAGE Parameters

Parameters Description

session_id

An identifier that represents a user's authenticated session

certificate

The user's certificate

private_key

The user's private key

original_content

The message content

certificate_list

The certificate list

signature

The digitally signed signature



GET_THEMES Procedure

This procedure retrieves the theme for the message or body-part. If a message object is specified, the entire message is processed. If a body-part object is specified, the part must be a simple type and not contain any other body-parts.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.sql_err

mail_errors.imt_err

mail_errors.bad_message_var

mail_errors.bad_msgpart_var

mail_errors.no_binary_err

Syntax

PROCEDURE get_themes (
    session_id IN NUMBER,
    message_obj IN MAIL_MESSAGE_OBJ,
    flags IN INTEGER,
    incl_binary_parts IN BOOLEAN,
    theme_buffer OUT ES_OT_API.THEME_TABLE);
PROCEDURE get_themes (
    session_id IN NUMBER,
    bodypart_obj IN MAIL_BODYPART_OBJ,
    flags IN INTEGER,
    incl_binary_parts IN BOOLEAN,
    theme_buffer OUT ES_OT_API.THEME_TABLE);

Parameters

Table 1-86 GET_THEMES Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

bodypart_obj

The body-part object

flags

Currently not used

incl_binary_parts

If false, the non-text part is ignored

theme_buffer

The theme buffer



GET_HIGHLIGHT Procedure

This procedure retrieves the highlights for the message or body-part. If a message object is specified, the entire message is processed. If a body-part object is specified, the part must be a simple type and not contain any other body-parts.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.sql_err

mail_erros.imt_err

mail_errors.bad_message_var

mail_errors.bad_msgpart_var

mail_errors.no_binary_err

Syntax

PROCEDURE get_highlight (
    session_id        IN NUMBER,
    message_obj       IN MAIL_MESSAGE_OBJ,
    flags             IN INTEGER,
    text_query        IN VARCHAR2,
    incl_binary_parts IN BOOLEAN,
    highlight_buffer  OUT ES_OT_API.HIGHLIGHT_TABLE);

PROCEDURE get_highlight (
    session_id        IN NUMBER,
    bodypart_obj      IN MAIL_BODYPART_OBJ,
    flags             IN INTEGER,
    text_query        IN VARCHAR2,
    incl_binary_parts IN BOOLEAN,
    highlight_buffer  OUT ES_OT_API.HIGHLIGHT_TABLE);

Parameters

Table 1-87 GET_HIGHLIGHT Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

bodypart_obj

The body-part object

flags

The returned buffer format

Values are:

  • MAIL_MESSAGE.GC_TEXT_FORMAT

  • MAIL_MESSAGE_GC_HTML_FORMAT

text_query

The string you want to query

incl_binary_parts

If false, the non-text part is ignored

highlight_buffer

The highlight buffer



GET_MARKUPTEXT Procedure

This procedure retrieves the mark-up text for the message or body-part. If a message object is specified, the entire message is processed. If a body-part object is specified, the part must be a simple type and not contain any other body-parts.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.sql_err

mail_erros.imt_err

mail_errors.bad_message_var

mail_errors.bad_msgpart_var

mail_errors.no_markup

mail_errors.no_binary_err

Syntax

PROCEDURE get_markuptext (
    session_id        IN NUMBER,
    message_obj       IN MAIL_MESSAGE_OBJ,
    flags             IN INTEGER,
    text_query        IN VARCHAR2,
    incl_binary_parts IN BOOLEAN,
    tag_set           IN VARCHAR2 DEFAULT 'TEXT_DEFUALT',
    start_tag         IN VARCHAR2 DEFAULT NULL,
    end_tag           IN VARCHAR2 DEFAULT NULL,
    prev_tag          IN VARCHAR2 DEFAULT NULL,
    next_tag          IN VARCHAR2 DEFAULT NULL,
    buffer            OUT CLOB);
PROCEDURE get_markuptext (
    session_id        IN NUMBER,
    bodypart_obj      IN MAIL_BODYPART_OBJ,
    flags             IN INTEGER,
    text_query        IN VARCHAR2,
    incl_binary_parts IN BOOLEAN,
    tag_set           IN VARCHAR2 DEFAULT 'TEXT_DEFUALT',
    start_tag         IN VARCHAR2 DEFAULT NULL,
    end_tag           IN VARCHAR2 DEFAULT NULL,
    prev_tag          IN VARCHAR2 DEFAULT NULL,
    next_tag          IN VARCHAR2 DEFAULT NULL,
    buffer            OUT CLOB);

Parameters

Table 1-88 GET_MARKUPTEXT Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

bodypart_obj

The body-part object

flags

The returned buffer format.

Values are:

  • MAIL_MESSAGE.GC_TEXT_FORMAT

  • MAIL_MESSAGE_GC_HTML_FORMAT

text_query

The string you want to query

incl_binary_parts

If false, non-text part is ignored

tag_set

Refer to Oracle Text documentation

start_tag

Refer to Oracle Text documentation

end_tag

Refer to Oracle Text documentation

prev_tag

Refer to Oracle Text documentation

next_tag

Refer to Oracle Text documentation

buffer

The mark-up text buffer



GET_FILTERED_TEXT Procedure

This procedure retrieves the filtered text for the message or body-part. If a message object is specified, the entire message is processed. If a body-part object is specified, the part must be a simple type and not contain any other body-parts.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.sql_err

mail_errors.imt_err

mail_errors.bad_message_var

mail_errors.bad_msgpart_var

mail_errors.no_binary_err

Syntax

PROCEDURE get_filtered_text (
    session_id IN NUMBER,
    message_obj IN MAIL_MESSAGE_OBJ,
    flags IN INTEGER,
    incl_binary_parts IN BOOLEAN,
    buffer OUT CLOB);
PROCEDURE get_filtered_text (
    session_id IN NUMBER,
    bodypart_obj IN MAIL_BODYPART_OBJ,
    flags IN INTEGER,
    incl_binary_parts IN BOOLEAN,
    buffer OUT CLOB);

Parameters

Table 1-89 GET_FILTERED_TEXT Parameters

Parameter Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

bodypart_obj

The body-part object

flags

The returned buffer format

Values are:

  • MAIL_MESSAGE.GC_TEXT_FORMAT

  • MAIL_MESSAGE_GC_HTML_FORMAT

incl_binary_parts

If false, the non-text part is ignored

buffer

The filtered text buffer



GET_TOKENS Procedure

This procedure retrieves the tokens for the message or body-part. If a message object is specified, the entire message is processed. If a body-part object is specified, the part must be a simple type and not contain any other body-parts.

Throws Exceptions

mail_errors.unauthenticated_err

mail_errors.sql_err

mail_errors.imt_err

mail_errors.bad_message_var

mail_errors.bad_msgpart_var

mail_errors.no_binary_err

Syntax

PROCEDURE get_tokens (
    session_id IN NUMBER,
    message_obj IN MAIL_MESSAGE_OBJ,
    language IN VARCHAR2,
    incl_binary_parts IN BOOLEAN,
    token_buffer OUT ES_OT_API.TOKEN_TABLE);
PROCEDURE get_tokens (
    session_id IN NUMBER,
    bodypart_obj IN MAIL_BODYPART_OBJ,
    language IN VARCHAR2,
    incl_binary_parts IN BOOLEAN,
    token_buffer OUT ES_OT_API.TOKEN_TABLE);

Parameters

Table 1-90 GET_TOKENS Parameters

Parameters Description

session_id

An identifier that represents a user's authenticated session

message_obj

The message object

bodypart_obj

The body-part object

language

The language of the message or body-part data.

incl_binary_parts

If false, the non-text part is ignored

token_buffer

The token buffer



Exceptions

external_rule_err EXCEPTION

Error No: 20001

Message: Error executing external rule

Cause: A rule defined as an external PL/SQL procedure failed during execution

Action: Check the correctness of the external PL/SQL procedure

external_cond_err EXCEPTION

Error No: 20002

Message: External condition failed

Cause: A condition defined as an external PL/SQL function failed during evaluation

Action: Check the correctness of the external PL/SQL function

too_many_rules EXCEPTION

Error No: 20003

Message: Too many rules fired, stop

Cause: Number of rules triggered for a message exceeded the maximum number of rules allowed. The default is 20

Action: Check if the rules involved causes infinite looping. Reduce the number of rules defined. Ask the administrator to increase the maximum number of rules allowed.

sql_err EXCEPTION

Error No: 20101

Message: Some SQL error occured: %s

Cause: An SQL error occured. See the error text returned for more information

Action: Refer to the Oracle9i Database Error Messages guide

imt_err EXCEPTION

Error No: 20102

Message: interMedia Text error: %s

Cause: Internal Oracle Text error occured. See the error text returned for more information

Action: Refer to the Oracle Text documentation

bad_message_var EXCEPTION

Error No: 20103

Message: No such message: %s

Cause: Exception is raised when the message or body-part object passed in is invalid. The message may have been removed by another mail session

Action: Ensure that the message or body-part object passed in is valid

bad_msgpart_var EXCEPTION

Error No: 20104

Message: No such message part: %s

Cause: Exception is raised when the MIME-level of the message or body-part object passed in is invalid

Action: Ensure that the MIME level of the message or body-part object passed in is valid

no_binary_err EXCEPTION

Error No: 20106

Message: No binary part: %s

Cause: Exception is raised when the specified message part is binary, but the API option specifies that binary is false

Action: Set the withbinary parameter to True for Oracle Text

unauthenticated_err EXCEPTION

Error No: 20201

Message: User needs to be authenticated first

Cause: User is not currently authenticated

Action: Call the mail_session.login() procedure to authenticate the user

folder_closed_err EXCEPTION

Error No: 20202

Message: Folder needs to be opened first!

Cause: Certain operations require that the folder involved be opened first

Action: Call the mail_folder.open_folder() procedure to open the folder first

msg_compose_limit_err EXCEPTION

Error No: 20203

Message: Compose one message at a time!

Cause: Exception is raised if user tries to compose more than one message at a time

Action: Send or append the current message before starting to compose the second message

folder_not_found_err EXCEPTION

Error No: 20204

Message: Folder does not exist: %s

Cause: Exception is raised if user is trying to do an operation on a folder that does not exist on the mail store

Action: Ensure that the folder exists before performing the operation

folder_already_exists_err EXCEPTION

Error No: 20205

Message: Folder already exists: %s

Cause: Exception is raised if user tries to create or rename as a folder name that already exists

Action: Choose a different folder name and retry

operation_not_allowed EXCEPTION

Error No: 20206

Message: Operation not allowed: %s

Cause: Possible causes for this exception are:

Action: Do not try to re-arrange a folder hierarchy with the rename operation. Use the create and delete operations to achieve the desired folder hierarchy

param_parse_err EXCEPTION

Error No: 20208

Message: Param parsing error: %s

Cause: Errors in the parameter passed into the API. Possible causes are:

Action: Correct the parameter passed to the API and try again

internal_err EXCEPTION

Error No: 20209

Message: Internal error: %s

Cause: An internal assertion has failed. Data is in an inconsistent state

Action: Contact Oracle Support

folder_name_err EXCEPTION

Error No: 20210

Message: Bad folder name: %s

Cause: Trying to create or rename a folder under another user's name space

Action: Correct the folder name and try again

login_err EXCEPTION

Error No: 20211

Message: Oracle Internet Directory Login Error: %s

Cause: Exception is raised when an invalid username or password is specified

Action: Check the spelling and try again

folder_type_err EXCEPTION

Error No: 20212

Message: Folder type voilation: %s

Cause: Possible causes for this error include:

Action: Avoid these types of folder violations

smime_err EXCEPTION

Error No: 20213

Message: S/MIME error: %s

Cause: Some error in calling S/MIME functions. The S/MIME error code reveals more details.

Action: Refer to the S/MIME documentation for the error code descriptions