SQL Server: Send email with embedded image(s)
THIS ARTICLE IS UNDER CONSTRUCTION!
PLEASE DO NOT EDIT IT OR REMOVE IT
Introduction
SQL Server includes a built-in stored procedure named sp_send_dbmail which provide a simple and fast way to send emails directly from the server. The SP allows sending email body formatted as HTML or as a simple text. Both options use a simple test as input for the body massage, which can be a result of a query execution using data from table(s). But what if we want to embed images into our email?
Well, we can always use external email and add image tag in the HTML code which points to the external image, but this means that the user will have to be online in order to read the email and see the images at the same time.
In this short article, we will show how we can embed an image(s) from a table in the database. The solution based on converting the image(s) to BASE64 string and using the code inside IMAGE tag in the HTML code
Solution - Step By Step
.
Resource and more to read
.
See Also
.