SmarterMail REST Wrapper
I recently switched to a web hosting provider after running my own servers for over 10 years. It's been an amazing burden off of my shoulders and has allowed me to focus on what's actually on my sites vs. what is running them.
One of the biggest challenges I faced over the years has been managing an email system that grew to close to 100,000 accounts. With the level of SPAM out there, it has been a real challenge. Now that we moved to a new provider, we no longer have the fine-grained control that we once did, but with the advent of web services it makes much of that irrelevant.
I created this CFC for managing email aliases and users on HostMySite.com's email servers, but this should work at any provider where SmarterMail's web services are made available. It has been tested with version 3 Enterprise but will probably work with others too.
The CFC has the following methods:
- init(ServiceURL, AuthUserName, AuthPassword, DomainName) - initialize CFC (all parameters required). ServiceURL is URL of the REST Web Service (without the '/Services/...')
- getAliases() - list all aliases.
- getAlias(AliasName) - get forwarding addresses for a specific alias.
- addAlias(AliasName, Addresses) - add a new alias with one or more forwarding addresses.
- updateAlias(AliasName, Addresses) - updates alias with new forwarding addresses.
- deleteAlias(AliasName) - removes an alias.
- getUsers() - list all user accounts.
- addUser(NewUsername, NewPassword, FirstName, LastName, maxMailboxSize, IsDomainAdmin) - add a new user account. maxMailboxSize is optional and defaults to 25 megabytes. IsDomainAdmin is also optional and defaults to false.
- deleteUser(Username) - deletes a user account.
- getDomainAliases() - list all domain aliases.
- addDomainAlias(NewDomain) - adds a domain alias.
- deleteDomainAlias(Domain) - deletes a domain alias.
Two test scripts are included - one which handles aliases and another user accounts. You must modify the first 3 lines of each with your account information, then just pull them up in a browser.
This is an initial release. There is nothing else planned at this time, so let me know if you need something. This should run fine on ColdFusion 6, 7, or 8, and probably earlier version too as long as you can parse an XML document.
This is released as open-source. The current version is 1.1 and you can visit the project page and download here.
