MailBee.NET Objects 4.0

Smtp.LicenseKey Property

Sets the license key.

public static string LicenseKey {get; set;}

Property Value

A string value which contains the license key which unlocks the component. This property is write-only.

Remarks

You can unlock the component by either setting this property to the valid permanent or trial license key or by adding MailBee.SmtpMail.Smtp.LicenseKey key in app.config, web.config, or machine.config file.

This property is static (Shared in Visual Basic). If not set in the config file, this property must be set before creating any instances of Smtp class.

Exceptions

Exception TypeCondition
MailBeeLicenseExceptionThe license key is invalid.

Example

Setting this property and connecting to an SMTP server.

[C#]
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.SmtpMail;

// The actual code (put it into a method of your class)

Smtp.LicenseKey = "Permanent or trial license key here";
Smtp mailer = new Smtp();
mailer.SmtpServers.Add("smtp.domain1.com");
mailer.Connect();
mailer.Disconnect();
[Visual Basic]
' To use the code below, import MailBee namespaces at the top of your code.
Imports MailBee
Imports MailBee.SmtpMail

' The actual code (put it into a method of your class)

Smtp.LicenseKey = "Permanent or trial license key here"
Dim mailer = New Smtp
mailer.SmtpServers.Add("smtp.domain1.com")
mailer.Connect()
mailer.Disconnect()
Setting the license key in the config file and connecting to an SMTP server.
[C#]
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.SmtpMail;

// The actual code (put it into a method of your class)

Smtp mailer = new Smtp();
mailer.SmtpServers.Add("smtp.domain1.com");
mailer.Connect();
mailer.Disconnect();

// XML config file (app.config, web.config, or machine.config):

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="MailBee.SmtpMail.Smtp.LicenseKey" value="Permanent or trial license key here"/>
</appSettings>
</configuration>

// In .NET 2.0, it can be <applicationSettings> instead of <appSettings>.
[Visual Basic]
' To use the code below, import MailBee namespaces at the top of your code.
Imports MailBee
Imports MailBee.SmtpMail

' The actual code (put it into a method of your class)

Dim mailer = New Smtp
mailer.SmtpServers.Add("smtp.domain1.com")
mailer.Connect()
mailer.Disconnect()

' XML config file (app.config, web.config, or machine.config):

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="MailBee.SmtpMail.Smtp.LicenseKey" value="Permanent or trial license key here"/>
</appSettings>
</configuration>

' In .NET 2.0, it can be <applicationSettings> instead of <appSettings>.

See Also

Smtp Class | MailBee.SmtpMail Namespace