sql-serverdatabase-mail

SQL Server: Email to operator in a stored procedure


Is it possible to send an email to an email operator in a stored procedure? I need to generate an HTML email. I can use sp_notify_operator, but that doesn't seem to have any option to set body_format to HTML and sp_send_dbmail doesn't seem to have a way to email an operator. Any suggestions?


Solution

  • get the email address from msdb.dbo.sysoperators

    then use sp_send_dbmail to send to that email address