Hello World Example |
Before using GemBox.Email, you need to install the component using one of the following methods:
Download and install GemBox.Email Setup.
Or install GemBox.Email NuGet package via the NuGet Package Manager.
Create a new .NET project (or use an existing one).
If you installed Setup, then add a reference to the GemBox.Email component using the Add Reference dialog (it'll be under Assemblies -> Extensions); otherwise you can skip this step (NuGet automatically adds a reference).
Add a directive for GemBox.Email namespace; for a C# project use "using GemBox.Email;", for a VB.NET project use "Import GemBox.Email".
Set the license key to use GemBox.Email in Free mode; for a C# project use "ComponentInfo.SetLicense("FREE-LIMITED-KEY");", for a VB.NET project use "ComponentInfo.SetLicense("FREE-LIMITED-KEY")".
Now you can write your application–specific email code like the one below.
Using GemBox.Email component is easy and straightforward. The following code shows how to download a message using PopClient:
using (PopClient pop = new PopClient("<ADDRESS> (e.g. pop.gmail.com)")) { // Connect to mail server and authenticate. pop.Connect(); pop.Authenticate("<USERNAME>", "<PASSWORD>"); // Download message with sequence number 1 (first one) and write its body. MailMessage message = pop.GetMessage(1); Console.WriteLine(message.BodyText); }