DB2 Version 9.7 for Linux, UNIX, and Windows

UTL_MAIL module

The UTL_MAIL module provides the capability to send email.

The schema for this module is SYSIBMADM.

The UTL_MAIL module includes the following routines.

Table 1. System-defined routines available in the UTL_MAIL module
Routine name Description
SEND procedure Packages and sends an email to an SMTP server.
SEND_ATTACH_RAW procedure Same as the SEND procedure, but with BLOB attachments.
SEND_ATTACH_VARCHAR2 Same as the SEND procedure, but with VARCHAR attachments

Usage notes

In order to successfully send an email using the UTL_MAIL module, the database configuration parameter SMTP_SERVER must contain one or more valid SMTP server addresses.

Examples

Example 1: To set up a single SMTP server with the default port 25:
db2 update db cfg using smtp_server 'smtp.ibm.com'
Example 2: To set up a single SMTP server that uses port 2000, rather than the default port 25:
db2 update db cfg using smtp_server 'smtp2.ibm.com:2000'
Example 3: To set a list of SMTP servers:
db2 update db cfg using smtp_server
   'smtp.example.com,smtp1.example.com:23,smtp2.example.com:2000'
Note: The email is sent to each of the SMTP servers, in the order listed, until a successful reply is received from one of the SMTP servers.