• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Write MBOX

Writes messages to an MBOX mailbox archive.

Code

using DRIT.Mail.Rfc.Mbox;
using DRIT.Mail.Rfc.Mime;

using var writer = new MboxWriter("output.mbox");

var message = new MimeMessage
{
    Subject = "Archived message",
};
message.From.Add(new MailboxAddress("sender@example.com", "Sender"));
message.To.Add(new MailboxAddress("recipient@example.com", "Recipient"));
message.Body = new TextPart("plain") { Text = "Body text." };

writer.Write(message, new System.DateTimeOffset(2026, 7, 27, 12, 0, 0, System.TimeSpan.Zero));

Remarks

MboxWriter serializes MimeMessage instances to an MBOX file. The From separator line is generated from the supplied timestamp and sender address.

  • Improve this Doc
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX