Click or drag to resize

Hello World Example

Before using GemBox.Email, you need to install the component using one of the following methods:

Step–by–step guide to using GemBox.Email

  1. Create a new .NET project (or use an existing one).

  2. 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).

  3. Add a directive for GemBox.Email namespace; for a C# project use "using GemBox.Email;", for a VB.NET project use "Import GemBox.Email".

  4. 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.

Example

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);
}