Click here to Skip to main content
15,880,891 members
Articles / Programming Languages / C#
Article

MDaemon Controler for .NET

Rate me:
Please Sign up or sign in to vote.
4.65/5 (9 votes)
19 Feb 2010CPOL2 min read 77K   1.3K   20   35
This .NET class allows to administrate the MDaemon Mail server, like creating domains and user accounts.

The MDaemon Mail Server

Do you need a mail server? Do you own Web Hosting and want to add Mail support for your clients?

You could install a Microsoft Exchange Server, but there is much better solution: I recommend MDaemon from alt-n technologies.

This mail server offers the same functionality, is cheaper, occupies less RAM and is much much easier to configure. The user can chose between several web themes - one of them looks exactly like Outlook Web Access. You can fully control the server's functionality from your own administration application written in C++ or .NET.

WorldClient.gif

AccountManager.gif

The MDaemon API

If you decide to add new mail domains and new user accounts 100% automatically, this is very easy.

  • In C++ you use the MDUser.dll which offers access to the entire server functionality .
  • In .NET you can use the MDUserCOM.dll which offers access to the majority of the funcionality, but not all.

I asked the alt-n technologies support why there are some function missing in the COM DLL like creating new domains for example. They never answered me.

The MDaemonController

So I wrote the MDaemonController .NET project. It is a managed C++ DLL that can be used in C# and VB .NET projects. It offers access to ALL API functions that are needed to create and manipulate domains and user accounts.

Interface.gif

Example to create a new domain in C#:

C#
using MDaemon;
cDomain i_Domain = new cDomain();
i_Domain.DomainName = "starwalker.com";
i_Domain.FQDN       = "starwalker.com";
i_Domain.IP         = "131.225.33.14";
i_Domain.MaxUsers   = 10000;
i_Domain.Create();

Example to create a new user in C#:

C#
using MDaemon;
cUser i_User = new cUser();
i_User.FullName  = "Johnny Walker";
i_User.Mailbox   = "jwalker";
i_User.Password  = "123ABC";
i_User.Domain    = "starwalker.com";
i_User.MailDir   = "C:\\emails\\jwalker";
i_User.WebConfig = cUser.eWebConfig.ACCESS_WORLDCLIENT | 
    cUser.eWebConfig.EDIT_PASSWORD | cUser.eWebConfig.IS_ADMIN;
i_User.Add();
  • You can create domains, create user accounts and modify existing domains and users and search users.
  • You can enumerate all domains and all users.
  • The classes cUser and cDomain have various properties which are automatically filled with the default server values when a new class is created. You can work with these defaults or modify them.
  • All C++ constants have been converted into handy .NET enumerations.
  • The classes have a clean error handling that translates the C++ error codes into human readable error messages which are thrown as exceptions.

The code uses the following C++ functions:
MD_InitDomainInfo, MD_FreeDomain, MD_WriteDomain, MD_DeleteDomain, MD_GetDomainCount, MD_GetDomainNames, MD_VerifyDomainInfo

and

MD_InitUserInfo, MD_GetFree, MD_VerifyUserInfo, MD_AddUser, MD_GetByEmail, MD_GetUserInfo, MD_SetUserInfo, MD_DeleteUser, MD_UserExists, MD_FindFirst, MD_GetEmail, MD_FindNext, MD_FindClose

More Functionality

If you need programmatical acces to Mailing Lists, Message Handling, Rule Management or Gateway Functions then add the MDUserCOM.dll to your .NET project that contains these functionalities.

The Demo Project

This DLL comes with a demo application that shows how to use the DLL. It is ultra easy so I will not explain much here.

Have a look into the code! The comments in the C++ code explain the functions. The C# demo shows how to use them.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) ElmüSoft
Chile Chile
Software Engineer since 40 years.

Comments and Discussions

 
QuestionOutlook connector Pin
Member 1045915211-Dec-13 21:50
Member 1045915211-Dec-13 21:50 
QuestionUnknown Error 4294967295 Pin
GCvignesh21-Aug-13 20:24
GCvignesh21-Aug-13 20:24 
AnswerRe: Unknown Error 4294967295 Pin
shaskhin_hi1-Mar-15 22:09
shaskhin_hi1-Mar-15 22:09 
QuestionApplication crashes while creating cUser object Pin
GCvignesh6-Aug-13 23:54
GCvignesh6-Aug-13 23:54 
AnswerRe: Application crashes while creating cUser object Pin
Elmue7-Aug-13 5:24
Elmue7-Aug-13 5:24 
GeneralMessage Closed Pin
11-Aug-13 19:56
GCvignesh11-Aug-13 19:56 
GeneralRe: Application crashes while creating cUser object Pin
Elmue13-Aug-13 17:17
Elmue13-Aug-13 17:17 
QuestionContact synchronisation Pin
Member990885614-Mar-13 6:11
Member990885614-Mar-13 6:11 
QuestionConnect remotely to MDaemon Pin
Member 792206118-Feb-13 23:29
Member 792206118-Feb-13 23:29 
QuestionRe: Connect remotely to MDaemon Pin
truc19907-May-13 3:45
truc19907-May-13 3:45 
QuestionTurn On and Off MDaemon Pin
Member 938339327-Nov-12 9:19
Member 938339327-Nov-12 9:19 
Questionthx Pin
arthur_veber24-Jun-12 21:44
arthur_veber24-Jun-12 21:44 
GeneralMy vote of 5 Pin
Manoj Kumar Choubey23-Feb-12 19:33
professionalManoj Kumar Choubey23-Feb-12 19:33 
QuestionHow to get all active Mdaemon sessionid Pin
rahul_saud26-Jun-11 20:39
rahul_saud26-Jun-11 20:39 
AnswerRe: How to get all active Mdaemon sessionid Pin
Elmue27-Jun-11 18:07
Elmue27-Jun-11 18:07 
QuestionI can't load the MDUser.dll [modified] Pin
Member 791583516-May-11 3:59
Member 791583516-May-11 3:59 
AnswerRe: I can't load the MDUser.dll Pin
Elmue16-May-11 4:59
Elmue16-May-11 4:59 
GeneralRe: I can't load the MDUser.dll [modified] Pin
Member 791583516-May-11 21:41
Member 791583516-May-11 21:41 
GeneralRe: I can't load the MDUser.dll [Resolved] Pin
Member 791583519-May-11 4:36
Member 791583519-May-11 4:36 
GeneralRe: creation date? Pin
Elmue19-May-11 4:46
Elmue19-May-11 4:46 
GeneralRe: I can't load the MDUser.dll Pin
Elmue19-May-11 4:38
Elmue19-May-11 4:38 
AnswerRe: I can't load the MDUser.dll Pin
Member 791583520-May-11 0:14
Member 791583520-May-11 0:14 
GeneralRe: I can't load the MDUser.dll Pin
Elmue20-May-11 5:35
Elmue20-May-11 5:35 
GeneralHow to get the date of the last user access Pin
Elmue20-May-11 5:39
Elmue20-May-11 5:39 
QuestionUnable to use 'GetPrivateProfileString(Section, Key, "", temp, 255, path)" Pin
rahul_saud28-Jun-11 19:07
rahul_saud28-Jun-11 19:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.