Build MIME
Builds a MIME message programmatically and writes it to a file.
Code
using DRIT.Mail.Rfc.Mime;
var message = new MimeMessage
{
Subject = "Hello from DRIT.Mail",
};
message.From.Add(new MailboxAddress("sender@example.com", "Sender"));
message.To.Add(new MailboxAddress("recipient@example.com", "Recipient"));
var textPart = new TextPart("plain")
{
Text = "This is the plain text body of the message.",
};
message.Body = textPart;
// Write the message to a file
message.Write("output.eml");
Remarks
MimeMessageBuilder offers a fluent API for constructing more complex
messages, including multipart/alternative and multipart/mixed structures with
attachments.