Sending HTML formatted emails using SQL table-SQLBrains.com
I often come across some scenarios where I have to send some data to end user with aggreated results in a email instead of giving read access to database, and that can be achieved sending the data in excel or csv format. That will work if you are dealing with some reasonable amount of data like few thousand rows. But if you have small data sets like less than 100 rows, then I prefer sending it in HTML format output which will be user friendly.
So, I have developed this routine to accomplish the task.