MailBee.NET Class Library  

Using MailBee.NET Objects in Your Projects

The following steps demonstrate how to use MailBee.NET Objects library in your applications.

Two versions of MailBee.NET.dll are shipped with the product: the generic version (works with .NET Framework 1.1 and above) and the version optimized for .NET Framework 2.0 and above. If your application is not intended to run on .NET Framework 1.1, select the optimized version.

Referencing MailBee.NET Objects library

In Visual Studio .NET

In the steps below, it's assumed your Visual Studio .NET project is named EmailApp.

  1. In the Solution Explorer, right-click the project name (EmailApp), and select Add and then Add Existing Item command in the context menu.
  2. In the appeared Add Existing Item dialog, select All Files under Files of type dropdown. Locate MailBee.NET.dll file (by default, it's installed into "C:\Program Files\MailBee.NET Objects\X.X" folder where "X.X" is .NET Framework version), and double-click it. Now MailBee.NET.dll gets uploaded into the root folder of EmailApp project.
  3. In the Solution Explorer, right-click the project name (EmailApp), and select Add Reference command in the context menu.
  4. In the appeared Add Reference dialog, click Browse button, select MailBee.NET.dll file, and double-click it. Now MailBee.NET Objects library gets referenced from your application.

In the steps above, we uploaded a copy of MailBee.NET.dll into the project folder and referenced this copy. The original MailBee.NET.dll is no longer needed. The application can be easily XCOPY deployed using this method.

In non-Visual Studio .NET environment

To reference MailBee.NET Objects library in non-Visual Studio .NET application, you should manually upload MailBee.NET.dll file into the /bin folder under the root folder of your application. If there is no /bin folder, you should create it first.

The application referencing MailBee.NET Objects library in such a way can take advantage of XCOPY deployment.

Importing MailBee namespaces

Once MailBee.NET Objects library is referenced from your application, the next step is to import namespaces declared in the library, into your application. In the code below, we import all available namespaces. You may then remove declarations of namespaces not used by your application.

Place the lines below at the top of your code file:

[Visual Basic]
Imports MailBee
Imports MailBee.DnsMX
Imports MailBee.Mime
Imports MailBee.SmtpMail
Imports MailBee.Pop3Mail
Imports MailBee.ImapMail
Imports MailBee.Security
Imports MailBee.AntiSpam
[C#]
using MailBee;
using MailBee.DnsMX;
using MailBee.Mime;
using MailBee.SmtpMail;
using MailBee.Pop3Mail;
using MailBee.ImapMail;
using MailBee.Security;
using MailBee.AntiSpam;
[ASP.NET Web Forms page]
<%@ Import Namespace="MailBee" %>
<%@ Import Namespace="MailBee.DnsMX" %>
<%@ Import Namespace="MailBee.Mime" %>
<%@ Import Namespace="MailBee.SmtpMail" %>
<%@ Import Namespace="MailBee.Pop3Mail" %>
<%@ Import Namespace="MailBee.ImapMail" %>
<%@ Import Namespace="MailBee.Security" %>
<%@ Import Namespace="MailBee.AntiSpam" %>

Assigning the license key

To unlock the product in trial or permanent mode, you need to assign the license key to the licensed component. The license key can be specified in config file (app.config, web.config, or machine.config), in Windows registry (SaveKey and SaveKeyGui utilities can place the license key into the registry), or in static (Shared in Visual Basic) LicenseKey property of the licensed component. See Using License Keys topic on how to obtain and specify the license key.

Usage example

Now you can use MailBee.NET Objects classes in your application. In this sample, we send a simple e-mail message with a single line of code.

[Visual Basic]
Smtp.QuickSend("from@me.com", "to@you.com", "Hello", "How are you?")
[C#]
Smtp.QuickSend("from@me.com", "to@you.com", "Hello", "How are you?");

 


Send feedback to AfterLogic

Copyright © 2006-2008 AfterLogic Corporation. All rights reserved.