Setting the execution context

When you use xp_sendmail to execute a query that has been submitted by e-mail, the procedure causes Adaptive Server to execute the query with the privileges of a particular Adaptive Server login in a particular database. This login/database combination is the execution context. By default, the login is “sybmail” and the database is master.

You can set the execution context for individual messages by passing different login and database values to xp_sendmail or sp_processmail with the following optional variables:

The following sections describe the execution context when the procedure specifies one, both, or neither of the optional variables.