Enable and disable catchall user to a domain using API

sandtech

Enable and disable catchall user to a domain using API

Postby sandtech » Tue Dec 10, 2002 6:17 am

Hi
Can any one tell me how to enable or disable catch all user to a domain using the mailenable api.
I have tried to using the add address map for adding the catch all user for domain, it works, but when i try to remove the catch all user for the domain, all the other address mappings are also getting removed for the user

does any one have the solutions...

thaks and regards...

sandtech

sunpost
Posts: 438
Joined: Wed Sep 04, 2002 3:04 pm

Postby sunpost » Sat Dec 14, 2002 11:18 pm

one thing that i noticed is that the RemoveAddressMap method updates the addressmap.tab file, but not the addressmap.bak file :?


Code: Select all

Function RemoveCatchall(pstrPostoffice As String, pstrDomainName As String) As Integer
Dim MyAddressMap As New MEAOAM.AddressMap

MyAddressMap.Account = pstrPostoffice
MyAddressMap.SourceAddress = "[SMTP:*@" & pstrDomainName & "]"
MyAddressMap.DestinationAddress = ""
MyAddressMap.Scope = ""

'if the catchall exists, rename and remove
If MyAddressMap.EditAddressMap(pstrPostoffice, "[remove]", "[catchall]", "0") Then
    MyAddressMap.Account = pstrPostoffice
    MyAddressMap.SourceAddress = "[remove]"
    MyAddressMap.DestinationAddress = "[catchall]"
    MyAddressMap.Scope = "0"
    RemoveCatchall = MyAddressMap.RemoveAddressMap
End If

Set MyAddressMap = Nothing

End Function


good luck!

Admin
Site Admin
Posts: 795
Joined: Mon Jun 10, 2002 6:31 pm
Location: Melbourne, Victoria, Australia

Postby Admin » Tue Dec 17, 2002 12:08 am

Since the RemoveAddressMap function accepts a wildcard, you cannot remove the catchall in one step. So as you see in sunposts post, you need to rename before removing.

The backup (.BAK) file is always 1 update out. It contains the contents of the TAB file before any change is made to the file (from an Edit/Remove/Add). So the backup is created before the edit is applied.

Who is online

Users browsing this forum: No registered users and 4 guests