April 27, 2015 at 12:54 pm
Hello
I wanted to implement the feature to send the email in HTML format from SQL. Which option will be more easy and less resource consumption? Like
sp_send_dbmail or sp_OAMethod or anything else?
Please provide the suggestion. Thanks!!!
Thanks
Shuaib
April 28, 2015 at 6:33 am
Hi,
You could use powershell as well ?
Not sure what all you want to be sent in the email; but if its something like disk space usage etc, then you can achieve that using PS. That way you don't need to enable the feature on SQL, and can have the PS script running from a different server altogether.
There are options where you can include nice HTML formatting in the PS code.
Thank you,
Ninad
April 28, 2015 at 8:15 am
ShuaibV (4/27/2015)
HelloI wanted to implement the feature to send the email in HTML format from SQL. Which option will be more easy and less resource consumption? Like
sp_send_dbmail or sp_OAMethod or anything else?
Please provide the suggestion. Thanks!!!
Thanks
Shuaib
sp_Send_DBMail works just fine. And, to be honest, I wouldn't increase the complexity of this by using PoSh. If you use the sp_OAMethod (which involves the use of CDONTS, which also works fine), you can avoid setting up sp_Send_DBMail but then you're just trading one feature for another insofar as surface area goes.
sp_send_dbmail requires users to have membership in the DatabaseMailUser database role in the msdb database. The sp_OA* methods require SysAdmin privs. I never give either to users or groups. Instead, I write stored procedures for the tasks at hand and grant privs to the stored procedures (usually by user group) and use EXECUTE AS OWNER in the stored procedures.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply