GlobalFixBadDates Property
Gets or sets if MailBee should attempt to fix bad datetime values instead of throwing an exception.

Namespace: MailBee
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
public static bool FixBadDates { get; set; }

Property Value

Type: Boolean
If true and the string date in the message being parsed contains time with invalid values of hours, minutes or seconds, Date property will return a valid datetime which is closest to the source invalid value. If false (the default value), MailBeeDateParsingException will be thrown in this case or Date property will return MinValue (depending on MailBee.Mime.MailMessage.ThrowExceptions value).

For instance, the message has Date: Fri, 30 May 2014 09:51:79 GMT in its headers. 79 is incorrect value for seconds. By default, MailBee will not parse such date. You can, however, enable FixBadDates and MailBee will return the datetime which corresponds to 30 May 2014 09:51:59 GMT value.

This lets the application ignore small errors in Date values which are often the case with messages created by some low quality mail programs or spam generators.

MailMessage.SetDateFromString method, Envelope.Date (and all other properties dealing with MIME Date format) are also affected by this setting.

Note Note
MailBee can fix only time part in wrong dates. Wrong days, months or years cannot be tolerated because the rounding difference will be too significant for getting satisfactory results.
See Also