---
title: "onemail cookbook"
url: https://recursiveai.org/onemail/cookbook/
description: "Answers to common email tasks in C#: read MSG, PST, OLM, EML and mbox files, convert Outlook mail to EML and mbox, Outlook appointments to ICS and RTF…"
version: "0.3.0-preview.2"
---

# onemail cookbook

Answers to common email tasks in C#: read MSG, PST, OLM, EML and mbox files, convert Outlook mail to EML and mbox, Outlook appointments to ICS and RTF bodies to HTML, 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.3.0-preview.2.

## Outlook files

- [Read an Outlook MSG file in C#](https://recursiveai.org/onemail/cookbook/read-msg-file/index.md): 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.3.0-preview.2.
- [Read a PST file in C#](https://recursiveai.org/onemail/cookbook/read-pst-file/index.md): 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.3.0-preview.2.
- [Read an OLM file in C#](https://recursiveai.org/onemail/cookbook/read-olm-file/index.md): Read an Outlook for Mac .olm file in C#: every folder, message, attachment, appointment, contact and task, with no Mac and no Outlook. Runnable code with OneMail 0.3.0-preview.2.
- [Open winmail.dat in C#](https://recursiveai.org/onemail/cookbook/open-winmail-dat/index.md): 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.3.0-preview.2.
- [Convert an RTF email body to HTML in C#](https://recursiveai.org/onemail/cookbook/convert-rtf-to-html/index.md): Convert an RTF email body to HTML in C#: Outlook .msg messages whose only body is RTF, with fonts, lists, tables, links and pictures, plus plain text. Runnable code with OneMail 0.3.0-preview.2.

## EML and mbox

- [Parse an EML file in C#](https://recursiveai.org/onemail/cookbook/parse-eml/index.md): 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.3.0-preview.2.
- [Read an mbox file in C#](https://recursiveai.org/onemail/cookbook/read-mbox/index.md): 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.3.0-preview.2.
- [Create an EML file in C#](https://recursiveai.org/onemail/cookbook/create-eml/index.md): 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.3.0-preview.2.

## Convert

- [Convert MSG to EML in C#](https://recursiveai.org/onemail/cookbook/convert-msg-to-eml/index.md): 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.3.0-preview.2.
- [Convert a PST file to EML in C#](https://recursiveai.org/onemail/cookbook/convert-pst-to-eml/index.md): 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.3.0-preview.2.
- [Convert a PST file to mbox in C#](https://recursiveai.org/onemail/cookbook/convert-pst-to-mbox/index.md): Convert a PST or OST file to mbox in C#: one mbox per Outlook folder, calendar items and contacts as .ics and .vcf, and a loss report. Also OLM, DBX and Maildir. Runnable code with OneMail 0.3.0-preview.2.

## Attachments

- [Extract attachments from email in C#](https://recursiveai.org/onemail/cookbook/extract-attachments/index.md): Extract attachments from email in C# and save them to disk: .eml, Outlook .msg, winmail.dat, PST and mbox with one loop, file names made safe. Runnable code with OneMail 0.3.0-preview.2.

## Calendars and contacts

- [Convert an Outlook appointment (MSG) to ICS in C#](https://recursiveai.org/onemail/cookbook/convert-msg-to-ics/index.md): Convert an Outlook calendar item (.msg appointment, meeting or task) to an .ics file in C#: start, end, time zone, location, attendees and recurrence, with a loss report. Runnable code with OneMail 0.3.0-preview.2.
- [Read an ICS calendar file in C#](https://recursiveai.org/onemail/cookbook/read-ics-file/index.md): 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.3.0-preview.2.
- [Read a vCard (.vcf) file in C#](https://recursiveai.org/onemail/cookbook/read-vcf-file/index.md): 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.3.0-preview.2.

## Command line

- [Inspect email files from the command line](https://recursiveai.org/onemail/cookbook/inspect-email-cli/index.md): Inspect .msg, .eml, .pst, mbox and winmail.dat files from the command line with the onemail .NET tool: sender, date, subject, attachments and defects, as text or JSON, and convert them to EML or mbox. OneMail.Cli 0.3.0-preview.2.
