Discuss this help topic in SecureBlackbox Forum
MIME: Create message with alternative parts
Below are the steps required to create a message with the alternate HTML + plain-text parts:
C#:
// step 1
TElMultiPartList listPart = new TElMultiPartList();
listPart.SetContentSubtype("alternative");
// step 2
TElMessage message = new TElMessage(listPart, "My Cool E-mail Client");
// step 3
message.From.AddAddress("Secretary", "sender@company.com");
message.To_.AddAddress("Addressee", "address@domain.com");
message.SetSubject("Test Message");
// step 4
TElPlainTextPart plainPart = new TElPlainTextPart(message);
plainPart.SetText(@"Just a test message");
TElPlainTextPart htmlPart = new TElPlainTextPart(message, message.MainPart);
htmlPart.SetText(@"<html><head></head><body><cite>Just a test message</cite></body></html>");
// step 5
htmlPart.SetContentSubtype("html");
// step 6
listPart.AddPart(plainPart);
listPart.AddPart(htmlPart);
// step 7
using (FileStream f = new FileStream(@"D:\test.eml", FileMode.Create, FileAccess.Write))
{
message.AssembleMessage(f);
f.Close();
}