Remote connection .NET assembly

WimVM
Posts: 27
Joined: Fri May 25, 2007 9:56 am

Remote connection .NET assembly

Postby WimVM » Fri Sep 03, 2010 11:31 am

I want to create postoffices, mailboxes, users with the .NET assembly. I found in another post here on the forum that the .NET assembly is "remotable". I understand from this that we can use the dll on another system and create mailboxes,... on the mail server.

This is exactly what we require, because our provisioning is on a centralized system. This system most be able to make a remote connection to the MailEnable server, but I can not find how this is done. How can I pass the servername, user and password for the mailenable server in my code using the .NET Administration Assemebly?

Wim

WimVM
Posts: 27
Joined: Fri May 25, 2007 9:56 am

Re: Remote connection .NET assembly

Postby WimVM » Tue Sep 07, 2010 8:30 am

Anyone?

How can I create a mailbox/addressmap/postoffice on the MailEnabled server, from an IIS Website that is not hosted on the same server as the MailEnable server? I also can not see anything to pass a username and password.

WimVM
Posts: 27
Joined: Fri May 25, 2007 9:56 am

Re: Remote connection .NET assembly

Postby WimVM » Thu Sep 09, 2010 10:05 pm

Can maybe someone from MailEnable take the time to answer my question? This forum is not highly used, so my question remains. I also found a lot of old posts, that remain unanswered, but basically asked the same question.

I have found this posts: viewtopic.php?f=4&t=9397&p=35283&hilit=.net+remote#wrap

Is a web service still the only way to do it, because I tried like this (the objects in the API doc are apperently not available in the .NET version):

Code: Select all

   Dim oHost As New MailEnable.Administration.Server
   oHost.Host = "10.0.2.108"
   oHost.SetHost()
   oHost.Status = -1
   oHost.Port = 8081
   oHost.DisplayName = ""
   oHost.Address = "10.0.2.108"

   Response.Write("Result: " & oHost.FindFirstServer())


I also wonder that I am using the latest version (found on the site): 1.0.2447.28179

DeShark
Posts: 6
Joined: Tue Sep 27, 2011 7:31 pm

Re: Remote connection .NET assembly

Postby DeShark » Fri Sep 30, 2011 7:07 pm

Did you ever get any answers on this topic? I am looking for the same answers. Please let me know what you found out or what your solution was.

Thanks,
DeShark

docgreg
Posts: 3
Joined: Sun Oct 30, 2011 3:41 pm

Re: Remote connection .NET assembly

Postby docgreg » Sun Oct 30, 2011 3:44 pm

I've never seen documentation that this is possible. I ended up creating a service to run on the server where mailenable is installed, with a UDP server integrated. I then access this service from my other computers to create mailboxes, postoffice, check mailbox enabled/disabled, reset passwords, etc. I would be willing to share this service, written in C# in VS 2010.
Greg

MailEnable
Site Admin
Posts: 4433
Joined: Tue Jun 25, 2002 3:03 am
Location: Melbourne, Victoria Australia

Re: Remote connection .NET assembly

Postby MailEnable » Wed Nov 16, 2011 12:34 am

The .NET way of doing this is through web services.

Please see "Web services" on the developer tools page at: http://www.mailenable.com/developer-resources.asp
(The interface has existed for some time, but I believe it has only recently been posted to the developer tools pages).

The readme in the zip file has instructions for deploying the asmx fles:

To install:

1.) Create a folder in the Mail Enable\bin directory called "WebServices"
2.) Put the asmx files into this directory
3.) Put the dlls into a subdirectory of the "WebServices" folder called "bin"
4.) Use the IIS Manager applet to create an application under a web site, for example, "MEWebServices"
5.) For the application, set the physical path to be the Mail Enable\bin\WebServices directory
6.) Set the Application Pool for this application to be MailEnableAppPool (this is what the webmail runs under)
7.) You should be able to test the web services now by using the URL http://localhost/mewebservices/postoffice.asmx (where localhost would be the site)
8.) You will need to secure the application so that it is only accessible by the clients you specify. Otherwise any connection has full access to the MailEnable configuration information
Regards, Andrew

avbm1980
Posts: 11
Joined: Sat Dec 10, 2011 9:48 am
Location: Australia

Re: Remote connection .NET assembly

Postby avbm1980 » Thu Dec 15, 2011 11:45 am

Remote connection .Net Assembly is done via web services in .Net,this is third party services...........

SilverFox
Posts: 1
Joined: Wed Dec 03, 2014 11:39 pm

Re: Remote connection .NET assembly

Postby SilverFox » Wed Dec 03, 2014 11:56 pm

Hi.
I have also decided to write my own WCF in C#.
For now I only needed 4 Methods:
bool CreateMailbox(string postOffice, string mailbox, string password) This Works ok.
bool DeleteMailbox(string postOffice, string mailbox) This Works ok.
List<string> ListMailboxes(string postOffice) This Works ok. (and fast because of Size = -4 :wink: )
bool ResetPassword(string postOffice, string mailbox, string newPassword) Here I have problems. :x
I have this code:

Code: Select all

        public bool ResetPassword(string postOffice, string mailbox, string newPassword)
        {
            Login l = new Login();
            l.Account = postOffice;
            l.UserName = String.Format("{0}@{1}", mailbox, postOffice);

            if (l.Exists(l.UserName))
            {
                if (l.EditLogin(l.UserName, 1, newPassword, l.Account, "", -1, -1, -1, "USER") == 1)
                {
                    return true;
                }
            }
            return false;
        }

It returns true when editing a valid login, but the password stays the same.
I have also tried to change the password of a non-existing mailbox, and it returns false, as expected.
Anyone?

And of course the solution came to me seconds later...:

Code: Select all

       public bool ResetPassword(string postOffice, string mailbox, string newPassword)
        {
            Login l = new Login();
            l.Account = postOffice;
            l.UserName = String.Format("{0}@{1}", mailbox, postOffice);
            l.Description = "";
            l.Password = "";
            l.Status = -1;
            l.LoginAttempts = -1;
            l.LastAttempt = -1;
            l.LastSuccessfulLogin = -1;
            l.Rights = "";

            if (l.FindFirstLogin() == 1)
            {
                if (l.EditLogin(l.UserName, l.Status, newPassword, l.Account, l.Description, l.LoginAttempts, l.LastAttempt, l.LastSuccessfulLogin,l.Rights) == 1)
                {
                    return true;
                }
            }
            return false;
        }

If anyone is interested in my Little project, or have a project of their own, they would like to share, send me a mail :D

iLens
Posts: 6
Joined: Thu Apr 23, 2015 10:49 am

Re: Remote connection .NET assembly

Postby iLens » Thu Apr 23, 2015 11:09 am

In the unlikely event you are still monitoring the forum, I'd welcome a copy of your WCF application

Who is online

Users browsing this forum: No registered users and 2 guests