MailBee.NET Queue  

Using app.config to configure MailBee.NET Queue

Getting started

When you configure MailBee.NET Queue with its Control Panel application, it actually stores all the settings in app.config file. You can also manually edit this file in case if you need advanced features not available through the Control Panel application. Also, you can create app.config file programmatically.

You can use Control Panel application and manual editing all together. For instance, if you manually added some settings which are not supported by Control Panel application, then opened that application, changed other options and saved the settings, your custom changes will not be lost. In other words, Control Panel application will preserve any custom changes you made.

app.config is the standard XML configuration file of a .NET application. All the configuration is stored within <Configuration> section. When MailBee.NET Queue Control Panel writes into this file, it simply serializes Config object of MailBee.NET Queue API (MailBeeNetQueueCore.dll). The same way, when MailBee.NET Queue itself or its Control Panel reads this file, it actually deserializes that Config object. Config class provides Load and Save methods which can be used to read or write app.config file.

To edit app.config manually, click Edit Config File button in "MailBee.NET Queue Start Menu" tool.

Advanced features which you can configure with app.config

<SmtpServers> and <DnsServers> sections must reside within <Queue> section which is in turn nested into <Configuration> section.

Below is the example of adding a DNS server for "direct send" mode. If you remove <SmtpServers> section, only "direct send" mode will be used. If you leave <SmtpServers> as-is, "direct send" will be used only as a fail-over for SMTP relay. To reverse things ("direct send" is primary, SMTP relay is fail-over), adjust their Priority values (less value means higher priority). You can add <DnsServers>...</DnsServers> just below </SmtpServers> or remove the entire <SmtpServers>...</SmtpServers> at all if you want to use "direct send" only. You can add more than one DNS server if you need to.

<DnsServers>
  <DnsServer>
    <Host>192.168.0.1</Host>
    <Priority>1</Priority>
    <UdpRetryCount>2</UdpRetryCount>
    <UdpTimeout>5000</UdpTimeout>
  </DnsServer>
 </DnsServers>

Using Config object in your applications

First, add a reference to MailBeeNetQueueCore.dll and MailBee.NET.dll to your application. You can find both .DLLs in the folder where you installed MailBee.NET Queue.

Declare namespaces of MailBee.NET Objects and MailBee.NET Queue in your code with using directive in C# and Imports in Visual Basic.

To read MailBee.NET Queue configuration from a file, use the static method Load of MailBee.Queue.Config class. This method returns the Config object containing the configuration. To save changes, use Save method of the Config object.

You can find the detailed VB and C# examples of using Config object to configure MailBee.NET Queue in MailBeeNetQueue/Source/Samples/VB EditConfig (and C# EditConfig, respectively) folder of My Documents (you can also use "Browse Samples" button in "MailBee.NET Queue Start Menu" tool to find Samples folder). EditConfig sample consists of several code snippets. Some of them configure the things which are not available in the Control Panel application (such as "direct send" mode).


Send feedback to AfterLogic

Copyright © 2011-2023 AfterLogic Corporation. All rights reserved.