title: How to execute sp_send_dbmail while limiting permissions
body: <p>Is there a way to provide access to users in my database to execute  <strong><code>msdb.dbo.sp_send_dbmail</code></strong> without needing to add them to the MSDB database and the DatabaseMailUserRole?</p>
  
  <p>I've tried this:</p>
  
  <pre><code>ALTER PROCEDURE [dbo].[_TestSendMail]
  (
    @To NVARCHAR(1000),
    @Subject NVARCHAR(100),
    @Body NVARCHAR(MAX)
  )
  WITH EXECUTE AS OWNER
  AS 
      BEGIN
          EXEC msdb.dbo.sp_send_dbmail @profile_name = N'myProfile',
              @recipients = @To, @subject = @Subject, @body = @Body
      END
  </code></pre>
  
  <p>But I get this error:</p>
  
  <pre><code>The EXECUTE permission was denied on the object 'sp_send_dbmail', database 'msdb', schema 'dbo'.
  </code></pre>
  
  <p>Thanks!</p>