Sicos1977 / MsgKit

A .NET library to make MSG files without the need for Outlook
204 stars 56 forks source link

No sender #33

Closed johnwc closed 6 years ago

johnwc commented 6 years ago

Is it possible to create a item with no sender set? When creating a draft, I'd like to have no sender and let Outlook set this when they actually send the email.

Sicos1977 commented 6 years ago

What you can do is just set sender to null like this.


using (var email = new Email(
    null,
    SubjectTextBox.Text, DraftMessageCheckBox.Checked))
{
    //email.Recipients.AddTo(ToTextBox.Text);
    email.Recipients.AddCc(CcTextBox.Text);
    email.Recipients.AddBcc(BccTextBox.Text);
    email.Subject = SubjectTextBox.Text;
    email.BodyText = TextBodyTextBox.Text;
    email.BodyHtml = HtmlBodyTextBox.Text;
    email.SentOn = SentOnDatePicker.Value.ToUniversalTime();
    // etc...
}