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:
C#:
// 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))
{
message.AssembleMessage(f);
f.Close();
}