Discuss this help topic in SecureBlackbox Forum

MIME: Create HTML message

Follow the instructions for creating a plain-text message, with one difference - you need to set content subtype of the text part to be HTML. This is done by setting to TElMessagePart.ContentSubtype property to "html" string (in some languages this will be a call to setContentSubtype or set_ContentSubtype method).


// step 1
TElPlainTextPart textPart = new TElPlainTextPart();
TElMessage message = new TElMessage(textPart, "My Cool E-mail Client");

// step 2
message.Sender.AddAddress("Secretary", "sender@company.com");
TElMailAddressGroup group = new TElMailAddressGroup();
group.Name = "Board of Directors";
group.AddAddress("John Dow", "john@company.com");
group.AddAddress("Mary Part", "mary@company.com");
message.From.AddGroup(group, false);
message.To_.AddAddress("Addressee 1", "address1@domain.com");
message.To_.AddAddress("Addressee 2", "address2@domain.com");
message.SetSubject("Test Message");

// step 3
textPart.SetText(@"<html><head></head><body><cite>Just a test message</cite></body></html>");

// step 4
using (FileStream f = new FileStream(@"D:\test.eml", FileMode.Create, FileAccess.Write))

How To articles about MIME

Discuss this help topic in SecureBlackbox Forum