0

Web site I work on (written in .NET) generates a lot of reports in HTML format. Some of them have images with the source ("src" attribute) pointing to a local file (i.e. local to the web site). If a user wants a report to be delivered by email we would convert images into System.Net.Mail.LinkedResource, replace "src" attributes by "src=cid:IdOfResource" and create "AlternateView" on Sytem.Net.Mail.MailMessage.AlternateViews collection. Does SendGrid support such scenario?

Salcio
  • 1
  • 1

1 Answers1

0

Yes, you can embed images in your emails that you send with SendGrid with cid resource URLs. You can read about how to do that in this article on how to embed images in your emails.

I don't know how the .NET "AlternateView" fits into this, but you can certainly embed images in your emails.

philnash
  • 70,667
  • 10
  • 60
  • 88
  • Thanks for the prompt answer. I mentioned "AlternateView" in .NET because this is how we used to handled the problem (and it is working). Anyhow, I read the article in the link you specified and did some testing. It appears that the solution is working as long as I use Html content only. If I add both Text and Html content then the email is not delivered (text is added first). Is it by design or there is a trick for this? – Salcio Aug 19 '22 at 13:34
  • That sounds like progress, but this new issue should probably be a new question. Can you ask a new question and share the code you are now using. Text and HTML content are definitely allowed together, and the content that appears should be what your email client is set to show. – philnash Aug 20 '22 at 00:56