Click here to Skip to main content
Click here to Skip to main content

Tagged as

MDaemon Controler for .NET

, 19 Feb 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
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.



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.


Example to create a new domain in C#:

using MDaemon;
cDomain i_Domain = new cDomain();
i_Domain.DomainName = "";
i_Domain.FQDN       = "";
i_Domain.IP         = "";
i_Domain.MaxUsers   = 10000;

Example to create a new user in C#:

using MDaemon;
cUser i_User = new cUser();
i_User.FullName  = "Johnny Walker";
i_User.Mailbox   = "jwalker";
i_User.Password  = "123ABC";
i_User.Domain    = "";
i_User.MailDir   = "C:\\emails\\jwalker";
i_User.WebConfig = cUser.eWebConfig.ACCESS_WORLDCLIENT | 
    cUser.eWebConfig.EDIT_PASSWORD | cUser.eWebConfig.IS_ADMIN;
  • 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


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.


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


About the Author

Software Developer (Senior) ElmüSoft
Chile Chile
Software Engineer since 27 years.

Comments and Discussions

QuestionOutlook connector PinmemberMember 1045915211-Dec-13 22:50 
QuestionUnknown Error 4294967295 PinmemberGCvignesh21-Aug-13 21:24 
AnswerRe: Unknown Error 4294967295 Pinmembershaskhin_hi1-Mar-15 23:09 
QuestionApplication crashes while creating cUser object PinmemberGCvignesh7-Aug-13 0:54 
AnswerRe: Application crashes while creating cUser object PinmemberElmue7-Aug-13 6:24 
GeneralMessage Removed PinmemberGCvignesh11-Aug-13 20:56 
GeneralRe: Application crashes while creating cUser object PinmemberElmue13-Aug-13 18:17 
QuestionContact synchronisation PinmemberMember990885614-Mar-13 7:11 
QuestionConnect remotely to MDaemon PinmemberMember 792206119-Feb-13 0:29 
QuestionRe: Connect remotely to MDaemon Pinmembertruc19907-May-13 4:45 
QuestionTurn On and Off MDaemon PinmemberMember 938339327-Nov-12 10:19 
Questionthx Pinmemberarthur_veber24-Jun-12 22:44 
GeneralMy vote of 5 Pinmembermanoj kumar choubey23-Feb-12 20:33 
QuestionHow to get all active Mdaemon sessionid Pinmemberrahul_saud26-Jun-11 21:39 
AnswerRe: How to get all active Mdaemon sessionid PinmemberElmue27-Jun-11 19:07 
QuestionI can't load the MDUser.dll [modified] PinmemberMember 791583516-May-11 4:59 
AnswerRe: I can't load the MDUser.dll PinmemberElmue16-May-11 5:59 
GeneralRe: I can't load the MDUser.dll [modified] PinmemberMember 791583516-May-11 22:41 
GeneralRe: I can't load the MDUser.dll [Resolved] PinmemberMember 791583519-May-11 5:36 
GeneralRe: creation date? PinmemberElmue19-May-11 5:46 
GeneralRe: I can't load the MDUser.dll PinmemberElmue19-May-11 5:38 
AnswerRe: I can't load the MDUser.dll PinmemberMember 791583520-May-11 1:14 
GeneralRe: I can't load the MDUser.dll PinmemberElmue20-May-11 6:35 
GeneralHow to get the date of the last user access PinmemberElmue20-May-11 6:39 
QuestionUnable to use 'GetPrivateProfileString(Section, Key, "", temp, 255, path)" Pinmemberrahul_saud28-Jun-11 20:07 
AnswerRe: DllImport PinmemberElmue29-Jun-11 6:08 
GeneralAdd user error Pinmemberfis200018-Apr-10 2:54 
GeneralRe: Add user error PinmvpElmue18-Apr-10 17:13 
GeneralRe: Add user error Pinmemberfis200020-Apr-10 10:35 
GeneralRe: Add user error PinmvpElmue20-Apr-10 12:58 
GeneralRe: Add user error Pinmemberfis200020-Apr-10 21:47 
GeneralRe: Add user error PinmvpElmue21-Apr-10 5:05 
GeneralRe: Add user error Pinmemberfis200022-Apr-10 9:04 
QuestionHow can I know password change date? Pinmembertaloweb21-Feb-10 7:56 
AnswerRe: How can I know password change date? PinmvpElmue22-Feb-10 2:46 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150331.1 | Last Updated 19 Feb 2010
Article Copyright 2010 by Elmue
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid