I need to process raw email messages and pull out the To and From addresses. I could just search for 'To: ' but I'd rather do this in a structured way to avoid issues.
How can I build a MIME message from raw email text, then get the To/From headers?
I've seen MimeKit used for sending emails before but don't seem to be able to find a way to hydrate MimeKit message object from a raw string so I can pull out the To/From headers. I get this runtime error if I just try passing raw email text into the constructor:
Exception: System.ArgumentException: Unknown initialization parameter: System.String
at MimeKit.MimeMessage..ctor(Object[] args)
at AWSS3Test.Services.CallS3.ListingObjectsAsync()
Google has returned nothing of use.
It doesn't have to be MIMEKit, but how can I do this?