ASA SQL Reference
System Procedures and Functions
System extended stored procedures
Adaptive Server Anywhere includes system procedures for sending electronic mail using the Microsoft Messaging API standard (MAPI) or the Internet standard Simple Mail Transfer Protocol (SMTP). These system procedures are implemented as extended stored procedures: each procedure calls a function in an external DLL.
In order to use the MAPI or SMTP stored procedures, a MAPI or SMTP e-mail system must be accessible from the database server machine.
The stored procedures are:
xp_startmail Starts a mail session in a specified mail account by logging onto the MAPI message system
xp_startsmtp Starts a mail session in a specified mail account by logging onto the SMTP message system
xp_sendmail Sends a mail message to specified users
xp_stopmail Closes the MAPI mail session
xp_stopsmtp Closes the SMTP mail session
The following procedure notifies a set of people that a backup has been completed.
CREATE PROCEDURE notify_backup() BEGIN CALL xp_startmail( mail_user='ServerAccount', mail_password='ServerPassword' ); CALL xp_sendmail( recipient='IS Group', subject='Backup', "message"='Backup completed' ); CALL xp_stopmail( ) END
The mail system procedures are discussed in the following sections.
xp_startmail system procedure
xp_startsmtp system procedure
xp_sendmail system procedure
xp_stopmail system procedure
xp_stopsmtp system procedure