I am trying to attach an image into a html template used to send emails. The code I am trying to make it work looks like this:
string body = System.IO.File.ReadAllText("./Resources/templates/myTemplate.html");
byte[] imageArray = System.IO.File.ReadAllBytes(@"logo.jpg");
string base64ImageRepresentation = Convert.ToBase64String(imageArray);
body = body.Replace("{imageBase64}", base64ImageRepresentation);
and the myTemplate.html code is:
<html>
<head></head>
   <body>
     <p>This is the email text</p>
     <img src={imageBase64}/>
   </body>
</html>
But the email is not being sent. If I remove the code related to the image the email is sent correctly.
Does anyone have an idea how to solve it?
 
    