Aegis Implicit Mail AIM AlternateView in MimeMailMessage

1.4k Views Asked by At

I am using AIM Aegis Implicit Mail to send Implicit ssl mails.

When using subject and body in a mail message all is fine, however when I use alternate views my mai lhas an empty body. This alternate view setup works with mailmessage and has html and text body depending on the reciving client but I must use MimeMailMessage which looks ok in the debug code but is empty when recivied in the mailbox.

Here's the code:

string plainTextBody = "Welkom.";

AlternateView plainTextView =
    AlternateView.CreateAlternateViewFromString(
        plainTextBody, null, MediaTypeNames.Text.Plain);
plainTextView.ContentType = new System.Net.Mime.ContentType("text/plain");
mail.AlternateViews.Add(plainTextView);

string htmlBody = @"<html><body><img src=""cid:logo""><br /> Welkom </body></html>";

AlternateView htmlView = AlternateView.CreateAlternateViewFromString(htmlBody, null, MediaTypeNames.Text.Html);
htmlView.ContentType = new System.Net.Mime.ContentType("text/html");
string imageSource = Path.Combine(HttpRuntime.AppDomainAppPath, @"Content\Images\Logob.png");
LinkedResource PictureRes = new LinkedResource(imageSource, MediaTypeNames.Image.Jpeg);
PictureRes.ContentId = "logo";
htmlView.LinkedResources.Add(PictureRes);
mail.AlternateViews.Add(htmlView);
1

There are 1 best solutions below

0
On

Aim is not providing AlternativeView, however you can use inline attachments to put your images and directly set HTML code in your message body. try to download the sample code and have a look on how inline attachments are working