to get this to work...
- In SSMS at: Databases > System Databases > msdb ...you must add the same user that you will use to connect to your database to call the SQL
- In SSMS at: Management > Database Mail ...right click and pick "Configure Database Mail" to prep the SMTP and the profile to be used as seen here:
set @Foo = ERROR_MESSAGE();
SET @Bar = 'Something went wrong.'
EXEC msdb.dbo.sp_send_dbmail
@profile_name='CustomerService'
,@recipients='tomjaeschke@tomjaeschke.com'
,@subject = @Bar
,@body = @EFoo
,@body_format = 'HTML'
No comments:
Post a Comment