Skip to content

Commit

Permalink
Update FAQ.md
Browse files Browse the repository at this point in the history
Added Encoding.RegisterProvider() to the FAQ
  • Loading branch information
jstedfast authored Dec 24, 2023
1 parent 2bb7db4 commit 679f70e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### General

* [Are MimeKit and MailKit completely free? Can I use them in my proprietary product(s)?](#completely-free)
* [Why am I getting `NotSupportedException: No data is available for encoding ######. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.`?](#register-provider)

### Messages

Expand Down Expand Up @@ -33,6 +34,19 @@
Yes. MimeKit and MailKit are both completely free and open source. They are both covered under the
[MIT](https://opensource.org/licenses/MIT) license.

### <a name="register-provider">Q: Why am I getting `NotSupportedException: No data is available for encoding ######. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.`?</a>

In .NET Core, Microsoft decided to split out the non-Unicode text encodings into a separate NuGet package called
[System.Text.Encoding.CodePages](https://www.nuget.org/packages/System.Text.Encoding.CodePages).

MimeKit already pulls in a reference to this NuGet package, so you shsouldn't need to add a reference to it in
your project. That said, you will still need to register the encoding provider. It is recommended that you add
the following line of code to your program initialization (e.g. the beginning of your program's Main() method):

```csharp
System.Text.Encoding.RegisterProvider (System.Text.CodePagesEncodingProvider.Instance);
```

## Messages

### <a name="create-attachments">Q: How do I create a message with attachments?</a>
Expand Down

0 comments on commit 679f70e

Please sign in to comment.