Create new mailbox with API

Discussion for developers using MailEnable.
Post Reply
programador
Posts: 5
Joined: Wed Dec 30, 2009 12:12 pm

Create new mailbox with API

Post by programador »

Hello, Im try to create a new mailbox but the return value always is 0.
this is my code:

Code: Select all

 Private Sub CreaMail() 
        Try
            Dim b As New MailEnable.Administration.Mailbox
            b.Host = "localhost"
            b.Postoffice = "deweb"
            b.Mailbox = "mispuebasnet"
            b.Status = 1
            b.Size = 0
            b.Limit = -1
            b.RedirectAddress = ""
            b.RedirectStatus = 0

            Dim i As Integer
            'Devuelve 1 si existe la cuenta y 0 si no existe
            i = b.GetMailbox()
            If i = 0 Then
                i = b.AddMailbox()

                Me.Label1.Text = i
            Else
                Me.Label1.Text = "La cuenta ya existe"
            End If

        Catch ex As Exception
            Me.Label1.Text = ex.Message
        End Try
    
    End Sub
Any idea?
Thanks

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

Re: Create new mailbox with API

Post by MailEnable »

Please see this post: http://forum.mailenable.com/viewtopic.php?f=4&t=18947
Also, in your code you should not set the Host property to "localhost"; setting it to a blank string is preferrable.
Regards, Andrew

programador
Posts: 5
Joined: Wed Dec 30, 2009 12:12 pm

Re: Create new mailbox with API

Post by programador »

thanks for reply,
I managed to solve this error, MailEnable config folder permissions for aspnet had not.
Now I know that password has been as much associated with that email

I need post the mail account and password to the client from my aplication.

programador
Posts: 5
Joined: Wed Dec 30, 2009 12:12 pm

Re: Create new mailbox with API

Post by programador »

Hello again,
I'm with the creation of mailbox from the api, I have two problems:
1. This makes no password for the account, when I access the MailEnable mailboxs from these messages appear:
Failed to get password entry from authentication store.
An entry will be created for you with a random password to fix this error.
You should enter a new password when possible.
Mailbox folder does not exist! It will now be created.
2. if I have an administrator account on the postoffice, when you run the code, the DLL returns 1 (create the mailbox), but not in the administration of mail enable. In the event viewer tells me the following:
General: (MailEnable Postoffice Service error: 5) Timed out waiting to apply changes for POSTOFFICE \ deweb \ MAILBOX.
But it created the folders in the mailbox postoffice

Any idea?

Post Reply