0

I want to send a mail using sp_send_dbmail in sql server having a svg element inside. But running this test the image does not appear inside the email body

DECLARE @HTML NVARCHAR(MAX)
SET @HTML = '
<html>
<body>

<svg  height="100" width="100">
  <circle xlink:href="img/test.png" cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
  Sorry, your browser does not support inline SVG.  
</svg> 
 
</body>
</html>
'

EXEC msdb.dbo.Sp_send_dbmail
      @profile_name = 'infoMessage',
      @recipients = 'ste...',
 
      @subject = '[WARNING] Invoice posted with missing data',
      @body = @html,
      @body_format ='HTML',
      @attach_query_result_as_file =0

This is only a test to see if the svg element works. I should integrate it with data queried from db. Do you knwo why it is not working? Regards

jarlh
  • 42,561
  • 8
  • 45
  • 63
  • Well, you have som png image but it is being sent in the email as attachment, or how is the email server supposed to access the image stored on your computer – siggemannen Aug 08 '23 at 13:47
  • 1
    You can't fill a svg circle element with an image like this. You either need to create a [pattern](https://stackoverflow.com/questions/3796025/fill-svg-path-element-with-a-background-image) or clip an `` element. Besides many email clients still don't support svg – herrstrietzel Aug 08 '23 at 15:14

0 Answers0