Gmail, Yahoo, Exchange Outlook etc was rendering the email perfectly fine.
Hotmail just need to have additional information in the email LinkedResource object.
Setting the properties LinkedResource.ContentType.Name and LinkedResource.TransferEncodig fixed this problem.
backImageResource.ContentType.Name = "dress_back";
backImageResource.TransferEncoding = TransferEncoding.Base64;
Here is my code example that work the emails working.
// Create the html AlternateView
AlternateView htmlView = AlternateView.CreateAlternateViewFromString(template.Body, null, "text/html");
// Add Linked Resources for the embedded images
LinkedResource frontImageResource = new LinkedResource(Utility.GetImageStream(DressFrontView, ImageFormat.Jpeg), MediaTypeNames.Image.Jpeg);
frontImageResource.ContentId = "dress_front";
frontImageResource.ContentType.Name = "dress_front";
frontImageResource.TransferEncoding = TransferEncoding.Base64;
LinkedResource backImageResource = new LinkedResource(Utility.GetImageStream(DressBackView, ImageFormat.Jpeg), MediaTypeNames.Image.Jpeg);
backImageResource.ContentId = "dress_back";
backImageResource.ContentType.Name = "dress_back";
backImageResource.TransferEncoding = TransferEncoding.Base64;
// Relate resources with AlternativeView
htmlView.LinkedResources.Add(frontImageResource);
htmlView.LinkedResources.Add(backImageResource);
After adding the ContentType.Name and TransferEncoding the e-mails displayed corrently in hotmail.
No comments:
Post a Comment