Wednesday, March 5, 2014

Limitations of Emailing in Microsoft SQL Server

How many times have you written a stored procedure in Microsoft SQL Server and had it set to send out an email from inside it. Pretty cool, huh? I've been doing this for years and without a single problem, until today. I thought for sure I was going crazy. I was convinced there must be some weird character in my code that is truncating my email body somehow. What I was seeing was just half an email body come through and the other half was just missing, no errors getting thrown at all. I tried all sorts of things to see if it was something in the text that I was sending.

Forward three hours later, and I found this is a limitation of SQL Server. Microsoft has set the email body size that can be sent out through database mail to only 4000 characters. Now doesn't that just bust your buttons! That really stinks. It severely limits the usefulness of sending rich content like HTML through SQL Server database mail.

Now here is my best workaround. You have to send email using other means outside of SQL Server. It's not the solution I wanted but a solution nonetheless.

No comments:

Post a Comment