Enable and disable catchall user to a domain using API


Enable and disable catchall user to a domain using API

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

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...


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!

Site Admin
Posts: 804
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 7 guests