C# winforms: A problem with sending an email cointaining the image background
Posted
by Tony
on Stack Overflow
See other posts from Stack Overflow
or by Tony
Published on 2010-04-20T00:25:14Z
Indexed on
2010/04/20
0:33 UTC
Read the original article
Hit count: 641
Hi, I'm trying to figure out how to resolve the problem:
I create the MailMessage object like that and send it:
MailMessage mail = new MailMessage();
mail.From = new MailAddress("[email protected]");
mail.To.Add("[email protected]");
mail.Subject = "This is an email";
AlternateView plainView = AlternateView.CreateAlternateViewFromString("This is my plain text content, viewable by those clients that don't support html", null, MediaTypeNames.Text.Plain);
(1) AlternateView htmlView = AlternateView.CreateAlternateViewFromString("Here is an embedded image.<img src=cid:companylogo>", null, "text/html");
LinkedResource logo = new LinkedResource("c:\\cop1.jpg");
logo.ContentId = "companylogo";
htmlView.LinkedResources.Add(logo);
mail.AlternateViews.Add(plainView);
mail.AlternateViews.Add(htmlView);
Everything is OK, the mail has the image in the background. But the problem is, when I change in the paragraph (1) from (click) to (click) everything fails, the image is not recognized and is threated as a attachment !
I think that is caused by the first colon here background-image:cid:companylogo
Is it possible to resolve that ?
© Stack Overflow or respective owner