Starts a SQL Mail client session.
xp_startmail [[@user =] 'user'] [,[@password =] 'password']
0 (success) or 1 (failure)
xp_startmail returns this message:
SQL mail session started.
If user and password are provided, Microsoft® SQL Server™ attempts to log on to Windows NT Mail (or other MAPI provider) using that username and password. If user and password are provided but are incorrect, an error message is returned. If user and password are not provided, SQL Server uses the username and password specified in the SQL Server Properties dialog box.
Note If you use xp_startmail to start your mail sessions, you can optionally supply your login name and password so that you do not have to type it at the command prompt. SQL Mail will “piggyback” an existing client session of Windows NT Mail if one is running.
If there is an existing mail session, xp_startmail does not start a new one. If mail is being used on the same computer on which SQL Server is also running, the mail client must be started either before xp_startmail is executed, or before SQL Server is started if SQL Mail is configured to automatically start when SQL Server starts.
Execute permissions for xp_startmail default to the members of the sysadmin fixed server role but can be granted to other users.
This example starts mail using the username and password specified in SQL Server Setup.
USE master
EXEC xp_startmail
This example starts mail using the username janetl and the password abc12345.
USE master
EXEC xp_startmail 'janetl', 'abc12345'
sp_processmail | xp_sendmail |
xp_deletemail | xp_stopmail |
xp_findnextmsg | Setting Up SQLAgentMail |
xp_readmail | System Stored Procedures (SQL Mail Extended Procedures) |