SQL 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 system procedures: each procedure calls a function in an external DLL.
These procedures are owned by the dbo user ID. Users must be granted EXECUTE permission before they can use these procedures, unless they already have DBA authority.
To use the MAPI or SMTP system procedures, a MAPI or SMTP email system must be accessible from the database server computer.
The MAPI and SMTP system procedures are:
xp_startmail Starts a mail session in a specified mail account by logging onto the MAPI message system. See xp_startmail system procedure.
xp_startsmtp Starts a mail session in a specified mail account by logging onto the SMTP message system. See xp_startsmtp system procedure.
xp_sendmail Sends a mail message to specified users. See xp_sendmail system procedure.
xp_stopmail Closes the MAPI mail session. See xp_stopmail system procedure.
xp_stopsmtp Closes the SMTP mail session. See xp_stopsmtp system procedure.
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; |
Return codes for MAPI and SMTP system procedures
Send feedback about this page via email or DocCommentXchange | Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0 |