`sp-send-dbmail` is a built-in stored procedure available in SQL Server since 2005, which allows one to send e-mails using the SQL service, for alerting a DBA when a problem is detected or limited reporting.
This procedure allows one to send an e-mail directly from SQL, including an optional query. It is well-suited for simple alerts and debugging, and in a pinch can be used to distribute reports, though it supports only a limited amount of formatting.
To use this sproc, one must first configure a Database Mail account and profile. This is available from within SQL Studio under [Server Name] > Management > Database Mail > right-click > Configure Database Mail.
Here's a code sample for a very simple message:
EXEC msdb..sp_send_dbmail
@profile_name = 'My Profile',
@recipients = 'dba@widgetcorp.com',
@from_address = 'database_alerts@widgetcorp.com',
@subject = 'Error Detected',
@body = 'A problem has been found, best get on it.'
sp-send-dbmail
has a large number of parameters, well-documented on MSDN: