Discuss this help topic in SecureBlackbox Forum
MIME: Create message
To create a simple MIME message, use TElSimpleMIMEMessage class.
If you need the message to contain plain text part, set BodyPlain property of TElSimpleMIMEMessage class. If you need the message to contain HTML part, set BodyHTML property of TElSimpleMIMEMessage class. When you set both properties, the created message becomes a multipart/alternative message with two alternative views.
Set the other properties, which make the message, such as Subject, To_, From and, optionally, other properties. If you need to set custom headers, for which no properties exist, read the corresponding how-to article.
If you need to add attachments, please read the corresponding how-to article.
The created message can be sent with TElSMTPClient or saved to a file or other custom stream.
C#:
// Create an instance of TElSimpleMIMEMessage
TElSimpleMIMEMessage message = new TElSimpleMIMEMessage();
// Setup properties of the message
message.Sender = "sender@domain.com";
message.From = "\"Message Author\" <author@domain.com>";
message.To_.Add("\"Addressee 1\" <address1@domain.com>");
message.To_.Add("\"Addressee 2\" <address2@domain.com>");
message.CC.Add("copyAddress@domain.com");
message.BCC.Add("hiddenCopy@domain.com");
message.Subject = "Test Message";
// Add the plain text body
message.BodyPlain.Text = "Just a test message";
// write the message to the stream
using (FileStream f = new FileStream(@"D:\test.eml", FileMode.Create, FileAccess.Write))
{
message.SaveToStream(f);
f.Close();
}