cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
New

Using sp_send_dbmail

I am needing the ability to send SQL results out via an email. The Database is a MS SQL db hosted on GoDaddy. In the past I have done this via stored or extended procedures in various MS SQL databases that I have had direct access to. 


Does anyone have information available as to how to do this.


I have tried the following for the sake of simply seieng if the general SP works but some one in this forum said it will not work and suggested i have GoDaddy grant me a Database Mail profile. I did run it via local SQL Studio and it indicates the CMD completed, BUT I never get the email. I also tried running the same SQL on the mylittle admin console provided by GoDaddy and I do receive a permissions error:


Msg 229, Level 14, State 5, Line number 1
The EXECUTE permission was denied on the object 'sp_send_dbmail', database 'msdb', schema 'dbo'.
Msg 5701, Level 0, State 1, Line number 1
Changed database context to 'msdb'.


Any help to get this working would be extremely beneficial!!!! Thank you in advance!

 

USE msdb;

EXEC msdb.dbo.sp_send_dbmail 
@profile_name = '', 
@recipients = 'me@gmail.com', 
@body = 'The stored procedure finished successfully.', 
@subject = 'Automated Success Message' ;