0

Hi everyone the following code works when I specify a physical path with share permission:

Declare @Body varchar(max);

Set @Body  = 
            'Here is a picture added to JKD Report:<br/><br/>
            Last Updated on: '+ CONVERT(VARCHAR(19),GETDATE())+'<br/>
            <br/>

            <img src="C:\emailpic.jpg">
            ';

EXEC msdb.dbo.sp_send_dbmail 
      @profile_name = 'JKD',   
      @recipients = 'doe@somewhere.com;',
      @body = @Body,
      @subject = 'JKD Email testing',
      @body_format = 'HTML'   

Is it possible to set the image in the html by using an image from a table? Thanks.

Angel Cloudwalker
  • 2,015
  • 5
  • 32
  • 54

1 Answers1

1

Add this to your body: <img src="data:image/jpg;base64,/*base64-data-string here*/" />

Shamelessly ripped from this question: embedding image in html email. The link has some details on converting your image to base64

Community
  • 1
  • 1
  • 1
    Thanks for the help, I tried converting the image to 64 base using this site http://www.base64-image.de/ however when I tried to execute in sql the email I get had an image error(box with red X). – Angel Cloudwalker Dec 05 '14 at 15:24