Enable and disable catchall user to a domain using API

Discussion for developers using MailEnable.
Post Reply
sandtech

Enable and disable catchall user to a domain using API

Post by sandtech »

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

Post by sunpost »

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: 1127
Joined: Mon Jun 10, 2002 6:31 pm
Location: Melbourne, Victoria, Australia

Post by Admin »

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.

Post Reply