(Windows only) Sends a message to the specified recipients. The message is either text or the results of a Transact-SQL query.
xp_sendmail recipient [; recipient] . . . [, subject] [, cc_recipient] . . . [, bcc_recipient] . . . [, {query | message}] [, attachname] [, attach_result = {true | false}] [, echo_error = {true | false}] [, include_file [, include_file] . . .] [, no_column_header = {true | false}] [, no_output = {true | false}] [, width] [, separator] [, dbuser] [, dbname] [, type] [, include_query = {true | false}]
xp_sendmail @recipient = "sally;ramon", @subject = "Adaptive Server Backup Status", @message = "Adaptive Server Backup for SERVER2 is complete.", @copy_recipient="admin"
xp_sendmail "peter", @query = "select * from authors", @attachname = "au_list.res", @attach_result= true
These parameters are related to the results of queries sent in a message when the query parameter is used. They are ignored if the message parameter is used instead: attachname, attach_result, echo_error, no_column_header, no_output, width, separator, dbuser, dname, include_query.
By default, only a system administrator can execute xp_sendmail. A system administrator can grant this permission to other users.