|
| 1 | +--- |
| 2 | +id: convert-to-email-with-advanced-options |
| 3 | +url: conversion/net/convert-to-email-with-advanced-options |
| 4 | +title: Convert to Email with advanced options |
| 5 | +weight: 17 |
| 6 | +description: "Follow this guide and learn how to convert between email formats (MSG, EML, EMLX) and customize attachment processing using GroupDocs.Conversion for .NET." |
| 7 | +keywords: Convert to Email, Convert to MSG, Convert to EML, Convert to EMLX, Email conversion, Email format conversion |
| 8 | +productName: GroupDocs.Conversion for .NET |
| 9 | +hideChildren: False |
| 10 | +toc: True |
| 11 | +--- |
| 12 | + |
| 13 | +## Introduction |
| 14 | + |
| 15 | +GroupDocs.Conversion provides [EmailConvertOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/emailconvertoptions) for converting between email formats. **Important**: EmailConvertOptions is specifically for email-to-email format conversions (e.g., MSG to EML), not for converting general documents to email formats. |
| 16 | + |
| 17 | +## Properties |
| 18 | + |
| 19 | +| Property | Type | Description | |
| 20 | +|----------|------|-------------| |
| 21 | +| [Format](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/convertoptions-1/format/) | `EmailFileType` | Specifies the desired email format. Available options are: *Eml, Emlx, Msg, Vcf, Mbox, Pst, Ost, Olm* | |
| 22 | +| [AttachmentContentHandler](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/emailconvertoptions/attachmentcontenthandler) | `Delegate` | A delegate to handle custom processing of email attachments during conversion | |
| 23 | + |
| 24 | +## Basic Usage |
| 25 | + |
| 26 | +Convert MSG files to EML format with default options: |
| 27 | + |
| 28 | +```csharp |
| 29 | +using (var converter = new Converter("message.msg")) |
| 30 | +{ |
| 31 | + var options = new EmailConvertOptions(); |
| 32 | + converter.Convert("message.eml", options); |
| 33 | +} |
| 34 | +``` |
| 35 | + |
| 36 | +## Converting Between Email Formats |
| 37 | + |
| 38 | +### Convert MSG to EML |
| 39 | + |
| 40 | +The most common email format conversion - from Outlook MSG to standard EML: |
| 41 | + |
| 42 | +```csharp |
| 43 | +using (var converter = new Converter("newsletter.msg")) |
| 44 | +{ |
| 45 | + var options = new EmailConvertOptions |
| 46 | + { |
| 47 | + Format = EmailFileType.Eml |
| 48 | + }; |
| 49 | + converter.Convert("newsletter.eml", options); |
| 50 | +} |
| 51 | +``` |
| 52 | + |
| 53 | +### Convert MSG to EMLX |
| 54 | + |
| 55 | +Convert Outlook messages to Apple Mail format: |
| 56 | + |
| 57 | +```csharp |
| 58 | +using (var converter = new Converter("meeting-invite.msg")) |
| 59 | +{ |
| 60 | + var options = new EmailConvertOptions |
| 61 | + { |
| 62 | + Format = EmailFileType.Emlx |
| 63 | + }; |
| 64 | + converter.Convert("meeting-invite.emlx", options); |
| 65 | +} |
| 66 | +``` |
| 67 | + |
| 68 | +### Convert EML to MSG |
| 69 | + |
| 70 | +Convert standard EML files to Outlook MSG format: |
| 71 | + |
| 72 | +```csharp |
| 73 | +using (var converter = new Converter("customer-inquiry.eml")) |
| 74 | +{ |
| 75 | + var options = new EmailConvertOptions |
| 76 | + { |
| 77 | + Format = EmailFileType.Msg |
| 78 | + }; |
| 79 | + converter.Convert("customer-inquiry.msg", options); |
| 80 | +} |
| 81 | +``` |
| 82 | + |
| 83 | +## Supported Email Formats |
| 84 | + |
| 85 | +EmailConvertOptions works with the following email formats: |
| 86 | + |
| 87 | +- **EML** - RFC-822 standard email format (most email clients) |
| 88 | +- **EMLX** - Apple Mail email format (macOS Mail app) |
| 89 | +- **MSG** - Microsoft Outlook and Exchange format |
| 90 | +- **VCF** - Virtual Card Format (contact information) |
| 91 | +- **MBOX** - Container format for email collections |
| 92 | +- **PST** - Outlook Personal Storage Files |
| 93 | +- **OST** - Outlook Offline Storage Files |
| 94 | +- **OLM** - Microsoft Outlook for macOS format |
| 95 | + |
| 96 | +**Note**: Not all format combinations are supported. The library supports commonly used conversions like MSG↔EML, MSG→EMLX, etc. |
| 97 | + |
| 98 | +## Email Format Details |
| 99 | + |
| 100 | +### MSG (Microsoft Outlook Message) |
| 101 | + |
| 102 | +MSG is the proprietary format used by Microsoft Outlook: |
| 103 | +- **Advantages**: Preserves Outlook-specific formatting, supports rich metadata |
| 104 | +- **Platform**: Windows Outlook, Exchange Server |
| 105 | +- **Use Case**: Enterprise email systems, Outlook integration |
| 106 | + |
| 107 | +### EML (Electronic Mail Format) |
| 108 | + |
| 109 | +EML is the standard RFC-822 email format: |
| 110 | +- **Advantages**: Universal compatibility, plain text based |
| 111 | +- **Platform**: Cross-platform (Thunderbird, Windows Mail, macOS Mail, webmail) |
| 112 | +- **Use Case**: Email archival, cross-platform compatibility, email backups |
| 113 | + |
| 114 | +### EMLX (Apple Mail Format) |
| 115 | + |
| 116 | +EMLX is Apple's implementation of the EML standard: |
| 117 | +- **Advantages**: Optimized for macOS Mail, includes additional metadata |
| 118 | +- **Platform**: macOS Mail application |
| 119 | +- **Use Case**: Mac-specific email workflows, Apple ecosystem integration |
| 120 | + |
| 121 | +## Common Use Cases |
| 122 | + |
| 123 | +### 1. Email Migration |
| 124 | + |
| 125 | +Migrate email archives between different email clients: |
| 126 | + |
| 127 | +```csharp |
| 128 | +// Convert Outlook MSG archive to standard EML for cross-platform use |
| 129 | +using (var converter = new Converter("archive-2024.msg")) |
| 130 | +{ |
| 131 | + var options = new EmailConvertOptions |
| 132 | + { |
| 133 | + Format = EmailFileType.Eml |
| 134 | + }; |
| 135 | + converter.Convert("archive-2024.eml", options); |
| 136 | +} |
| 137 | +``` |
| 138 | + |
| 139 | +### 2. Platform Migration |
| 140 | + |
| 141 | +Move from Windows Outlook to macOS Mail: |
| 142 | + |
| 143 | +```csharp |
| 144 | +// Convert MSG emails to EMLX for Apple Mail |
| 145 | +using (var converter = new Converter("important-emails.msg")) |
| 146 | +{ |
| 147 | + var options = new EmailConvertOptions |
| 148 | + { |
| 149 | + Format = EmailFileType.Emlx |
| 150 | + }; |
| 151 | + converter.Convert("important-emails.emlx", options); |
| 152 | +} |
| 153 | +``` |
| 154 | + |
| 155 | +### 3. Email Standardization |
| 156 | + |
| 157 | +Convert proprietary formats to standards-based formats: |
| 158 | + |
| 159 | +```csharp |
| 160 | +// Standardize various email formats to EML |
| 161 | +using (var converter = new Converter("meeting-notes.msg")) |
| 162 | +{ |
| 163 | + var options = new EmailConvertOptions |
| 164 | + { |
| 165 | + Format = EmailFileType.Eml |
| 166 | + }; |
| 167 | + converter.Convert("meeting-notes.eml", options); |
| 168 | +} |
| 169 | +``` |
| 170 | + |
| 171 | +### 4. Email Client Compatibility |
| 172 | + |
| 173 | +Ensure emails can be opened in different email clients: |
| 174 | + |
| 175 | +```csharp |
| 176 | +// Convert EML to MSG for Outlook users |
| 177 | +using (var converter = new Converter("customer-feedback.eml")) |
| 178 | +{ |
| 179 | + var options = new EmailConvertOptions |
| 180 | + { |
| 181 | + Format = EmailFileType.Msg |
| 182 | + }; |
| 183 | + converter.Convert("customer-feedback.msg", options); |
| 184 | +} |
| 185 | +``` |
| 186 | + |
| 187 | +## When to Use EmailConvertOptions |
| 188 | + |
| 189 | +Use EmailConvertOptions when you need to: |
| 190 | + |
| 191 | +- **Migrate email systems** between different platforms (Outlook ↔ Apple Mail ↔ Thunderbird) |
| 192 | +- **Archive emails** in standard formats for long-term storage |
| 193 | +- **Ensure compatibility** across different email clients |
| 194 | +- **Convert between formats** for workflow integration |
| 195 | +- **Standardize email formats** within an organization |
| 196 | +- **Support multi-platform** email access |
| 197 | + |
| 198 | +## Limitations |
| 199 | + |
| 200 | +### Email-to-Email Only |
| 201 | + |
| 202 | +EmailConvertOptions is **not** for converting general documents to email formats: |
| 203 | + |
| 204 | +```csharp |
| 205 | +// ❌ This will NOT work - cannot convert PDF to email format |
| 206 | +using (var converter = new Converter("document.pdf")) |
| 207 | +{ |
| 208 | + var options = new EmailConvertOptions { Format = EmailFileType.Msg }; |
| 209 | + converter.Convert("document.msg", options); // ConversionNotSupportedException |
| 210 | +} |
| 211 | +``` |
| 212 | + |
| 213 | +### Supported Source Formats |
| 214 | + |
| 215 | +EmailConvertOptions works with: |
| 216 | +- Email formats converting to other email formats |
| 217 | +- Some format combinations may not be supported (e.g., MSG to MBOX) |
| 218 | + |
| 219 | +## Converting Emails to Other Formats |
| 220 | + |
| 221 | +To convert email messages to documents (PDF, DOCX, etc.), use the appropriate ConvertOptions for the target format: |
| 222 | + |
| 223 | +```csharp |
| 224 | +// ✅ Convert email to PDF |
| 225 | +using (var converter = new Converter("message.msg")) |
| 226 | +{ |
| 227 | + var options = new PdfConvertOptions(); |
| 228 | + converter.Convert("message.pdf", options); |
| 229 | +} |
| 230 | + |
| 231 | +// ✅ Convert email to Word document |
| 232 | +using (var converter = new Converter("newsletter.eml")) |
| 233 | +{ |
| 234 | + var options = new WordProcessingConvertOptions(); |
| 235 | + converter.Convert("newsletter.docx", options); |
| 236 | +} |
| 237 | +``` |
| 238 | + |
| 239 | +## Best Practices |
| 240 | + |
| 241 | +1. **Choose the right target format**: |
| 242 | + - Use EML for maximum cross-platform compatibility |
| 243 | + - Use MSG for Outlook-specific workflows |
| 244 | + - Use EMLX for macOS Mail integration |
| 245 | + |
| 246 | +2. **Test format combinations**: |
| 247 | + - Not all email-to-email conversions are supported |
| 248 | + - Verify your specific conversion path works before batch processing |
| 249 | + |
| 250 | +3. **Preserve email structure**: |
| 251 | + - Email formats preserve headers, attachments, and metadata differently |
| 252 | + - Test conversions to ensure critical information is retained |
| 253 | + |
| 254 | +4. **Handle attachments appropriately**: |
| 255 | + - Email attachments are typically preserved during format conversion |
| 256 | + - Use AttachmentContentHandler for custom attachment processing needs |
| 257 | + |
| 258 | +## Summary |
| 259 | + |
| 260 | +EmailConvertOptions provides control over email format conversions: |
| 261 | + |
| 262 | +- **Email-to-Email conversions**: Convert between MSG, EML, EMLX, and other email formats |
| 263 | +- **Platform migration**: Move emails between different email clients and platforms |
| 264 | +- **Format standardization**: Convert proprietary formats to standards-based formats |
| 265 | +- **Important limitation**: Cannot convert general documents to email formats |
| 266 | + |
| 267 | +All examples on this page have been verified through automated testing to ensure accuracy. |
| 268 | + |
| 269 | +## See Also |
| 270 | + |
| 271 | +- [Convert Email Formats - Basic Usage]({{< ref "conversion/net/developer-guide/basic-usage/convert/email" >}}) |
| 272 | +- [Load Email Documents with Options]({{< ref "conversion/net/developer-guide/advanced-usage/loading/load-options-for-different-document-types/load-email-document-with-options" >}}) |
| 273 | +- [Convert Email Attachments]({{< ref "conversion/net/developer-guide/advanced-usage/converting/conversion-options-by-document-family/convert-each-email-attachment-to-different-format" >}}) |
| 274 | +- [EmailConvertOptions API Reference](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.convert/emailconvertoptions/) |
| 275 | +- [EmailFileType API Reference](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.filetypes/emailfiletype/) |
0 commit comments