Click here to Skip to main content
Licence CPOL
First Posted 19 Feb 2010
Views 17,024
Downloads 311
Bookmarked 19 times

MDaemon Controler for .NET

By | 19 Feb 2010 | Article
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#:

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#:

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)

About the Author

Elmue

Software Developer (Senior)
ElmüSoft
Chile Chile

Member

Software Engineer since 27 years.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 5 Pinmembermanoj kumar choubey19:33 23 Feb '12  
QuestionHow to get all active Mdaemon sessionid Pinmemberrahul_saud20:39 26 Jun '11  
AnswerRe: How to get all active Mdaemon sessionid PinmemberElmue18:07 27 Jun '11  
QuestionI can't load the MDUser.dll [modified] PinmemberMember 79158353:59 16 May '11  
AnswerRe: I can't load the MDUser.dll PinmemberElmue4:59 16 May '11  
GeneralRe: I can't load the MDUser.dll [modified] PinmemberMember 791583521:41 16 May '11  
GeneralRe: I can't load the MDUser.dll [Resolved] PinmemberMember 79158354:36 19 May '11  
GeneralRe: creation date? PinmemberElmue4:46 19 May '11  
GeneralRe: I can't load the MDUser.dll PinmemberElmue4:38 19 May '11  
AnswerRe: I can't load the MDUser.dll PinmemberMember 79158350:14 20 May '11  
GeneralRe: I can't load the MDUser.dll PinmemberElmue5:35 20 May '11  
GeneralHow to get the date of the last user access PinmemberElmue5:39 20 May '11  
QuestionUnable to use 'GetPrivateProfileString(Section, Key, "", temp, 255, path)" Pinmemberrahul_saud19:07 28 Jun '11  
AnswerRe: DllImport PinmemberElmue5:08 29 Jun '11  
GeneralAdd user error Pinmemberfis20001:54 18 Apr '10  
GeneralRe: Add user error PinmvpElmue16:13 18 Apr '10  
GeneralRe: Add user error Pinmemberfis20009:35 20 Apr '10  
GeneralRe: Add user error PinmvpElmue11:58 20 Apr '10  
GeneralRe: Add user error Pinmemberfis200020:47 20 Apr '10  
GeneralRe: Add user error PinmvpElmue4:05 21 Apr '10  
GeneralRe: Add user error Pinmemberfis20008:04 22 Apr '10  
QuestionHow can I know password change date? Pinmembertaloweb6:56 21 Feb '10  
AnswerRe: How can I know password change date? PinmvpElmue1:46 22 Feb '10  

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.

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