The essence of the problem:
Actually I want to see a letter of the same kind as what Outlook sends. Everything is beautiful. But in the description of the MailMessage class there is absolutely no documentation on how to make such a letter. For example, if you write instead of a link to a picture, the name of the picture is in the attachment, then it will of course be displayed, but it will also be displayed as an attachment (which you don’t want).
Origins
When you try to send a letter in HTML format using .Net, without special actions, the letter is displayed incorrectly in mail systems and mail programs (not all), which is unpleasant. Actually the trouble is that the pictures are visible as attachments and sometimes distort the form of the letter.
Decision
Having rummaged on the Internet, I found out that such a thing can be turned with the help of an alternative representation of a letter.
It turns out that when sending a letter it may contain several views for displaying in a different format.
But what to do with these ideas was not very clear; reading the documentation led me to the following:
')
To create a letter with pictures that are not displayed without attachments, you need to create an alternative view and upload pictures there as resources
in this example, I will give only the code to create an alternative view and add it to the letter
var mailMessage = new System.Net.Mail.MailMessage(); var mailHTML =