Getting Started
This topic contains the following sections:
Adding MailKit to your project via NuGet
Using the .NET CLI, enter the following command from within your project directory:
dotnet add package MailKit
Or, in Visual Studio's Package Manager Console, enter the following command:
Install-Package MailKit
Adding S/MIME, OpenPGP, DKIM and ARC support
As of MimeKit 5.0, MimeKit's S/MIME, PGP/MIME, DKIM, ARC and DMARC support lives in the separate MimeKit.Cryptography package. If your application needs any of these features, you'll also need to add a reference to it:
dotnet add package MimeKit.Cryptography
In order for the parser to create cryptographic MIME entities such as MultipartSigned, MultipartEncrypted and ApplicationPkcs7Mime (instead of a plain Multipart or MimePart), the cryptography module must be initialized before any messages are parsed. The best place to do this is during your application's startup:
using MimeKit.Cryptography;
CryptographyModule.Initialize ();
Building MailKit from Source
First, you'll need to clone MailKit from the GitHub repository:
git clone https://github.com/jstedfast/MailKit.git
Then, since MailKit makes use of git submodules, you will need to initialize and update the submodules using the following command from within the MailKit directory:
git submodule update --init --recursive
In the top-level MailKit source directory, there are several solution files:
-
MailKit.sln includes projects for .NET Framework 4.6.2, 4.7 and 4.8, .NETStandard 2.0 and 2.1, .NET 8.0, .NET 10.0, and the unit tests.
-
MailKit.Documentation.sln includes projects for generating the documentation that you are reading right now.
Once you've opened the appropriate MailKit solution file in Visual Studio (or any other IDE that supports SDK-style projects), you can choose the Debug or Release build configuration and then build.