onemailCookbook
onemail cookbook
Answers to common email tasks in C#: read MSG, PST, EML and mbox files, convert Outlook mail to EML, pull out attachments, read calendars and contacts. Each recipe is a complete program you can run on a public sample file, with the output it really prints on OneMail 0.2.0-preview.2.
Outlook files
Read an Outlook MSG file in C#Read an Outlook .msg file in C#: subject, sender, recipients, date, text and HTML bodies and attachments, with no Outlook and no COM. Runnable code with OneMail 0.2.0-preview.2.Read a PST file in C#Read an Outlook PST or OST file in C# without Outlook: walk every folder and message, with sender, date, subject and attachments. Runnable code with OneMail 0.2.0-preview.2.Open winmail.dat in C#Open a winmail.dat (TNEF) file in C# and save the attachments Outlook packed inside it. Works on the file alone or inside an email. Runnable code with OneMail 0.2.0-preview.2.
EML and mbox
Parse an EML file in C#Parse an .eml file in C#: subject, addresses, date, decoded text and HTML bodies and attachments, from a file or bytes. Malformed mail is repaired, not thrown. Runnable code with OneMail 0.2.0-preview.2.Read an mbox file in C#Read an mbox file in C# message by message: sender, date, subject and body. mboxo, mboxrd, mboxcl, mboxcl2 and Gmail Takeout exports. Runnable code with OneMail 0.2.0-preview.2.Create an EML file in C#Create an .eml file in C#: headers, a plain text and HTML body and an attachment, written as standard MIME any mail program opens. Runnable code with OneMail 0.2.0-preview.2.
Convert
Convert MSG to EML in C#Convert an Outlook .msg file to .eml in C#, with attachments, both bodies and a report of every property that didn’t carry over. Runnable code with OneMail 0.2.0-preview.2.Convert a PST file to EML in C#Convert a PST or OST file to EML files in C#: one .eml per message, in a folder per PST folder, with attachments and a loss report. Runnable code with OneMail 0.2.0-preview.2.
Calendars and contacts
Read an ICS calendar file in C#Read an .ics calendar file in C# and list every occurrence of recurring events, with RRULE, EXDATE, moved instances and time zones applied. Runnable code with OneMail.Calendar 0.2.0-preview.2.Read a vCard (.vcf) file in C#Read a .vcf vCard file in C#: names, emails, phone numbers, addresses, organization and birthdays from vCard 2.1, 3.0 and 4.0. Runnable code with OneMail.Calendar 0.2.0-preview.2.