Set the Execution Context

When you use xp_sendmail to execute a query that has been submitted via an e-mail message, 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 these variables: