• This article tells you "how", but my question would be "why?". Why would you even want to do this?

    This is a horrendous solution. It is a sequence of ugly hacks, and almost every step of the article has something that makes me cringe.

    SQL Server is a database engine, not some general purpose application programming environment. Use the database to store and manipulate data. Leave the higher level stuff like constructing HTML documents and sending emails to a general purpose programming language like C#.

    People who are commenting that this is a beautiful solution do not know the meaning of beauty.