API probelm

Discussion for developers using MailEnable.
Post Reply
noamway
Posts: 66
Joined: Sat Aug 12, 2006 5:11 am

API probelm

Post by noamway »

I'm using "MailEnable Professional Edition - Version 1.x" and whem I'm try to use the API option I'm getting this error:
The call to Server.CreateObject failed while checking permissions. Access is denied to this object.

Who can I fix that without touch the server like they explain here:
http://www.mailenable.com/kb/Content/Ar ... D=me020163
because my server manaer told me that if I try to fix this problem it's can cause problem on my server security (I don't know way).

There is any other options? like ASP.NET or "Third Party Applications"?

Thanks for your answer :-)

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

Post by MailEnable »

The answer is no.. but the problem is not specifically a MailEnable issue as much as the way Windows application frameworks security models work.

If you are intending to call any COM, ASP.NET, etc library from IIS, you will need to give the service account or proxy user access to appropriate DLL/Resources.

In the case of ASP.NET applications, the same applies although the proxy account is typically brokered to the ASPNET account rather than the IIS anon user IUSER_XXXXX proxy account. (there is more to this, but its not directly relevant to your immeidate issue).

If your only referring to giving IIS access to the MEASP.DLL file then it is relatively harmless to do as the article suggests and give the IIS proxy account access to the DLL. You could also consider registering the DLL under COM+ (which would acheive a security model similar to that available with ASP.NET applications in as much that the the IIS worker process would call the COM+ surrogate; which is in turn running under a different identity.

If your referring to other DLL functions, then you should be able to call these through the COM+ interfaces (assuming your using Pro or Ent).
See MEWebMail.XXXX and MEAdmin.XXX - more examples in the ASP sounces of MailEnable. See also: http://www.mailenable.com/developers/WebMailClass.htm

As mentioned, IMO, there is no forseeable reason why you may want to not give the IIS user access to the DLL if you require that its functionality be available under IIS (and to try to do anything else would fail because you would always need to eventually provide a means of giving the IIS identity access to the underlying resources whether through COM+, "the framework", or by modifying the ACL of the DLL itself).
Regards, Andrew

noamway
Posts: 66
Joined: Sat Aug 12, 2006 5:11 am

Thanks for your answer, one more

Post by noamway »

I read the article here:
http://www.mailenable.com/kb/Content/Ar ... D=me020163

And I try to use this example:
"Add Mailbox via ASP" here:
http://www.mailenable.com/developerresources.asp

in this example they using this component:
MEAOPO
MEAOAU

Do I need to this component the same?

noamway
Posts: 66
Joined: Sat Aug 12, 2006 5:11 am

It's not work

Post by noamway »

after I add premmesion all dll files the code not working.
I think maybe it's because my mailenable work in D: folder and not C: folder.

This is my code:

Code: Select all

<%
'Add functions - add one email address.
' adds postoffice, mailbox, login And maps email address
Public Function AddFullEmail(Email,Password)
  
  Dim UserName, Domain
  Domain = Split(Email, "@")(1)
  UserName = Split(Email, "@")(0)

  Dim result
  result = CreatePostOffice(Domain)
  If result <> 0 Then result = AddDoaminToPostOffice(Domain)
  If result <> 0 Then result = AddMailBoxToPostOffice(Domain, UserName)
  If result <> 0 Then result = AddLogin(Domain, UserName, Password)
  If result <> 0 Then result = AddEmail(Domain, UserName, Email)
  AddFullEmail = result
End Function

Function CreatePostOffice(name)
  Dim lResult
  Dim PostOffice
  Set PostOffice = CreateObject("MEAOPO.Postoffice")
  
  With PostOffice
    .name = name
    .Host = name
    .Account = name
    .Status = 1
    'Try To get existing postoffice
    lResult = .GetPostoffice()
    If lResult = 0 Then 'create the postoffice
      lResult = .AddPostoffice()
    Else 'Postoffice already exists.
      lResult = -1
    End If
  End With
  CreatePostOffice = lResult
End Function

'Adds domain To postoffice
Function AddDoaminToPostOffice(PostOffice,DomainName)
  If Len(DomainName) = 0 Then DomainName = PostOffice
  
  Dim lResult
  Dim oDomain
  Set oDomain = CreateObject("MEAOSM.Domain")
  
  With oDomain
    .AccountName = PostOffice
    .DomainName = DomainName
    .Status = 1
    'try To get existing domain.
    lResult = .GetDomain
    If lResult = 0 Then 'create the postoffice
      lResult = .AddDomain
    Else 'Postoffice already exists.
      lResult = -1
    End If
  End With
  AddDoaminToPostOffice = lResult
End Function
          

'Adds mailbox To postoffice
Function AddMailBoxToPostOffice(PostOffice,UserName,Limit)
  
  
  Dim lResult
  Dim oMailbox
  Set oMailbox = CreateObject("MEAOPO.Mailbox")

  With oMailbox
    .PostOffice = PostOffice
    .Mailbox = UserName
    .RedirectAddress = ""
    .RedirectStatus = 0
    .Status = 1
    
    'try To get existing Mailbox.
    lResult = .GetMailbox
    If lResult = 0 Then 'create the Mailbox
      .Limit = Limit
      lResult = .AddMailbox()
    Else 'Mailbox already exists.
      lResult = -1
    End If
  End With
  AddMailBoxToPostOffice = lResult
End Function
      
      
'Adds Login To postoffice
Function AddLogin(PostOffice,UserName,Password)
  
  
  Dim lResult
  Dim oAUTHLogin
  Set oAUTHLogin = CreateObject("MEAOAU.Login")

  'when we create a mailbox we also create a pop logon
  With oAUTHLogin
    .Account = PostOffice
    .UserName = UserName & "@" & PostOffice
    .Status = 1
    .Description = ""
    .Host = ""
    .Rights = "USER"
    
    'try To get existing login.
    lResult = .GetLogin()
    If lResult = 0 Then 'create the login
      .Password = Password
      lResult = .AddLogin()
    Else 'login already exists.
      lResult = -1
    End If
  End With
  AddLogin = lResult
End Function
      
'Adds domain To postoffice
Function AddEmail(PostOffice,UserName,Email)
  
  Dim lResult
  Dim oAddressMap
  Set oAddressMap = CreateObject("MEAOAM.AddressMap")

  With oAddressMap
    Dim varTemp
    
    .Account = PostOffice
    .DestinationAddress = "[SF:" & PostOffice & "/" & UserName & "]"
    .Scope = "[SMTP:" & Email & "]"
    .SourceAddress = "[SMTP:" & Email & "]"
    
    'try To get existing email address.
    lResult = .GetAddressMap
    If lResult = 0 Then 'create a new email address map
      lResult = .AddAddressMap()
    Else 'email address already exists.
      lResult = -1
    End If
  End With
  AddEmail = lResult
End Function



response.write AddFullEmail("noam@goop.co.il","fdss332csdf")
%>

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

Post by MailEnable »

The IIS identity will also need access to MailEnable resources. Specifically the Config (Read).

A simpler solution for you is to simply call the MEAdmin object instead (although this will only work on Pro and Ent editions).

Eg:
Set oLogin = Server.CreateObject("MEWebAdmin.Login")
Set oMailbox = Server.CreateObject("MEWebAdmin.Mailbox")

etc..

Basically, you can omit the likes of MEAOAU, MEAOPO, etc and sub in MEWebAdmin.

This object is already registered under Com+, so the security issues are taken care of for you. Further examples can be found in the signup utility example.

http://www.mailenable.com/kb/Content/Ar ... D=me020103
Regards, Andrew

noamway
Posts: 66
Joined: Sat Aug 12, 2006 5:11 am

I don't understand

Post by noamway »

I don't understand, Do you have any article that expalin all the step I need to do for let my users open a mail box from my website?

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

Post by MailEnable »

What do you mean by "open a mail box"? Do you mean access and list the messages of the mailbox, or create one?

In any case, I suggest you browse the ASP files of MailEnable since you can leverage code from there. Specifically install mailenable and select the ASP option - then browse the ASP files and installed under the MailEnable BIN directory.
Regards, Andrew

noamway
Posts: 66
Joined: Sat Aug 12, 2006 5:11 am

Post by noamway »

Ok! now I see the ASP files (thanks) but I don't unserstand this:
MailEnable wrote:Specifically install mailenable and select the ASP option - then browse the ASP files and installed under the MailEnable BIN directory.
What do you mean?

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

Post by MailEnable »

As follows (less typos):

1. Install mailenable and select the ASP option
2. Then (using explorer) browse the ASP files installed under the MailEnable BIN directory.

You will find examples of using ASP with MailEnable there.
Regards, Andrew

noamway
Posts: 66
Joined: Sat Aug 12, 2006 5:11 am

Post by noamway »

Thanks!!!
It's working great...

Post Reply