+1 vote

Can you help me how to set the X-Mailer tag when sending an email?

by

1 Answer

0 votes
 
Best answer

You do that by adding a custom header using AddCustomHeader method on MailBuilder instance, while creating an email.

MailBuilder builder = new MailBuilder();
builder.Subject = "Test";
builder.Text = "This is plain text message.";

builder.From.Add(new MailBox("alice@mail.com", "Alice"));
builder.To.Add(new MailBox("bob@mail.com", "Bob"));

builder.AddCustomHeader("X-Mailer", "MyMailer 1.0");

IMail email = builder.Create();

// Send the message
using (Smtp smtp = new Smtp())
{
    smtp.Connect("server.example.com");    // or ConnectSSL
    smtp.UseBestLogin("user", "password");
    smtp.SendMessage(email);
    smtp.Close();
}
by (297k points)
...