Sicos1977 / MsgKit

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

[fix] Invalid Win32 Time when converting .eml without a date (not sent yet) #102

Closed Meetsch closed 1 year ago

Meetsch commented 1 year ago

MsgKit was throwing an exception while trying to convert .eml not having a date set (not sent yet).

I was generating .eml using simple python script, but they couldn't be converted by MsgKit because MsgKit was setting the SentOn date to 01.01.0001, then when writing as a .msg is was throwing 'Invalid Win32 Time'.

My fix is to avoid setting the SentOn when the date is 01.01.0001, luckily your code had SentOn nullable and the writing to .msg made proper use of that.

Meetsch commented 1 year ago

Note: The AppVeyor build is broken, not related to my commit which is building fine on VS2022 and is just a nice and simple fix without side effect on what was working.