MailMessageSetDateFromString Method
Sets the date of the message creation as a string.

Namespace: MailBee.Mime
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
public void SetDateFromString(
	string date
)

Parameters

date
Type: SystemString
A string in RFC822 data format containing the date and time of the moment when the message was composed.
Exceptions
ExceptionCondition
MailBeeInvalidArgumentExceptiondate is a null reference (Nothing in Visual Basic).
Remarks

This method sets the value of Date header of the message. The value should be in RFC822 format (like Tue, 09 Oct 2007 12:36:00 -0300), but this method allows setting any value except a null reference. If you specify it as an empty string, Date header will not be added to the message at all.

This method by default won't allow out-of-range values in date parts (for instance, 79 seconds while 59 is the maximum allowed value). You can, however, enable FixBadDates to let MailBee tolerate some not significant errors (although this is not recommended).

To set this date as DateTime value, use Date property.

Note Note
MailBee sets the date automatically to the current datetime when the message gets sent or submitted to the pickup folder. To suppress this, set msg.Builder.SetDateOnSend = false (assuming msg is MailMessage instance) prior to sending the message.
Examples
This sample creates a new message and sets the the date when it was composed.
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.Mime;

// The actual code (put it into a method of your class).
MailMessage msg = new MailMessage();
Console.WriteLine(msg.Date.ToString());
msg.SetDateFromString("Thu, 31 Mar 2005 17:34:25 -0400");
Console.WriteLine(msg.Date.ToString());
See Also