Discuss this help topic in SecureBlackbox Forum

MIME: Create plain-text message

TElMessage class is more complicated than TElSimpleMIMEMessage and it allows to create almost any message structure, and access or change any header field on any level of the message structure.

Below are the steps required to create a simple text message:

  1. Create an instance of TElPlainTextPart class
  2. Create an instance of TElMessage class with the main part set to the previously created instance of TElPlainTextPart class;
  3. Setup message parameters (the code snippet below shows how to use address groups - a named collection of mail addresses);
  4. Put message text
  5. Assemble the message to a stream using AssembleMessage() 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("Just a test message");

// 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