Create Mailbox using ASP.NET

Discussion for developers using MailEnable.
Post Reply
rockinthesixstring
Posts: 844
Joined: Mon Dec 05, 2005 7:51 am
Location: Canada

Create Mailbox using ASP.NET

Post by rockinthesixstring »

Can someone tell me how to create a new mailbox in ASP.NET? I tried looking at the documentation but couldn't find what I was looking for.

Does 3.5 have a nice handy web service like SM so that mailboxes can be created from servers that are separate from the Email server?

If not... I suppose I would like to post this as a suggestion.
Chase
Server 2008 Standard (x64)
ME Ent 6.51 (SQL Server 2008 Config)
ASSP 1.9

tametcalfe
Posts: 1
Joined: Thu Dec 18, 2003 11:59 am

Post by tametcalfe »

Hi,

This is something I'm sure alot of developers would find useful. Anyone out there know how to achieve this?

Thanks

Tim

priyappated
Posts: 6
Joined: Wed Jan 14, 2009 12:48 pm

Post by priyappated »

Hi I have put some asp.net code here if it can help you,

MailEnable.Administration.Mailbox mailBoxCreate = new MailEnable.Administration.Mailbox();

mailBoxCreate.Postoffice = "PostOfficeName";
mailBoxCreate.Mailbox = "MailBoxName";//Name you want for mailbox
mailBoxCreate.RedirectAddress = "";
mailBoxCreate.RedirectStatus = 0;
mailBoxCreate.Status = 1;
mailBoxCreate.Limit = -1; //-1 for unlimited

int mailResult = mailBoxCreate.AddMailbox();

mattblack
Posts: 20
Joined: Mon Jan 11, 2010 9:35 pm

Re: Create Mailbox using ASP.NET

Post by mattblack »

Can someone please help with this? I'm new to asp.net (Though very experienced with ASP and IIS) and I just can't get this code snippet working.

I desperately need a way to create and delete mailboxes from IIS before i buy ME.

If I try this code as-is, in a Page_Load sub, I get...

Compiler Error Message: BC30451: Name 'MailEnable' is not declared.

Is there some kind of namespace I have to import? I've tried copying the files from MEWebAdmin but they import a file (like "UserWizard1.aspx.vb") which doesn't exist - so I can't even see how it's done there.

PLEASE will someone help!

mattblack
Posts: 20
Joined: Mon Jan 11, 2010 9:35 pm

Re: Create Mailbox using ASP.NET

Post by mattblack »

Think I've figured it out!! Copied the BIN folder from the MEWebAdmin and added every dll i could find on the resources page online. See to be at least doing something now.

Watch this space!

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

Re: Create Mailbox using ASP.NET

Post by MailEnable »

You should not need to copy any files from the MailEnable BIN directory into your application's Bin/Executable directory.

You should simply download and use the Administration Assembly from http://www.mailenable.com/developerresources.asp. (Any other DLLs will be found by the assembly via searching your windows path statement for them).

To get started, I suggest that you first get familiar with developing a simple VB.NET application to trial using the API. You can download the necessary assemboly from this zip file: http://www.mailenable.com/developers/Ma ... .Admin.zip
This zip file should get you started with a VB.Net desktop application: http://www.mailenable.com/developers/VBNetTest.zip

Once you have done this, you can create a web project in Visual Studio and add the DLL as a reference to your project.

The admnistration assembly is strongly typed and remotable (so it is possible to use the assembly on one machine and to to add a mailbox on another machine).
Regards, Andrew

mattblack
Posts: 20
Joined: Mon Jan 11, 2010 9:35 pm

Re: Create Mailbox using ASP.NET

Post by mattblack »

Thanks for the reply Andrew.

I've spent a couple of days learning .net and the Visual Web Developer tool (Which is brilliant!!). Spent a lot of time tearing my hair out because I couldn't get the namespace/dll files right and so nothing was being recognised. All these include-files were driving me mad.

But anyhow, I've done it! I've created an aspx page (With a .vb include file) that I can call from a URL, with an action=Create/Disable/Enable, username=xxxxx, password=xxxxx parametres and it works perfectly!

I still think you need to get some aspx files online to show people how it's done... took me a long time to figure this out (About 26 hours full-on, which would have been more like 4 hours if I'd had examples to work with).

Also, the documentation seriously needs more information. Like about the GetLogin() for example, if you don't give a status then it doesn't work right (but what if you want to pull any account whether it's enabled or not?). The docs should tell you what fields are required and there should be more information about each function (And again, more examples! There's very few examples in the reference files).

It would take your team of programmers no time at all to get some examples made up, and I think the majority of ME customers are trying to create web applications (Why would I want to make my own desktop app when i can use the ME app?).

Thanks again!

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

Re: Create Mailbox using ASP.NET

Post by DeShark »

Matt,

Care to share what you've created? I think ME needs a public opensource webservice project for all to share.

Thnks,
DeShark

AUZSOLUTIONS
Posts: 1
Joined: Sun Mar 18, 2012 1:16 am

Re: Create Mailbox using ASP.NET

Post by AUZSOLUTIONS »

Hi Matt,

Are you interested in sharring what you have done?

Thanks
Tristan

dananos
Posts: 2
Joined: Fri Aug 08, 2014 9:56 am

Re: Create Mailbox using ASP.NET

Post by dananos »

Can anyone offer any advice on how to set up permissions in IIS to get a webpage to set up a new mailbox in mailenable?

I've tried using the sample "Classic ASP" script "addmailbox.asp" downloaded from Mailenable, but when I run it, I get

Server object error 'ASP 0178 : 80070005'

Server.CreateObject Access Error

/addmailbox.asp, line 19

The call to Server.CreateObject failed while checking permissions. Access is denied to this object.

- The Application Pool is running under LocalSystem account, and IIS is in 32 bit mode. Mailenable is running fine otherwise, and I have access to email.

Please Help!

Post Reply