Here's the code that adds "X-Mailer" header to the email message:
MailBuilder builder = new MailBuilder();
builder.From.Add(new MailBox("alice@example.com"));
builder.To.Add(new MailBox("bob@example.com"));
builder.Subject = "hello";
builder.Text = "body";
builder.AddCustomHeader("X-Mailer", "my-mailer 1.0");
IMail mail = builder.Create();
Assert.AreEqual("my-mailer 1.0", mail.Headers["x-mailer"]);
You can use following code to see how your email looks like:
Console.WriteLine(Encoding.ASCII.GetString(mail.Render()));
This is how the rendered email looks like:
Content-Type: text/plain;
charset="utf-8"
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
Date: Fri, 23 Oct 2015 12:46:03 +0200
Message-ID: <763cab77-7f0d-49f3-9126-506d9abc96b1@mail.dll>
Subject: hello
From: <alice@example.com>
To: <bob@example.com>
X-Mailer: my-mailer 1.0
body
Invoking MailBuilder.AddCustomHeader multiple times with the same key, doesn't override previous values - this way you can add same key (with different values) several times.