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.

Related Blog Entries

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Rick Germany's Gravatar Hello-

This has worked great with Smartermail 3, but I get an error when I upgraded to Smartermail 4:

Server Error in '/SmarterMail' Application.
________________________________________
Request format is unrecognized for URL unexpectedly ending in '/GetAlias'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Request format is unrecognized for URL unexpectedly ending in '/GetAlias'.

Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidOperationException: Request format is unrecognized for URL unexpectedly ending in '/GetAlias'.]
System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +490982
System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +104
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +175
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +120
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

________________________________________
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
-----------------------------------------------------------------------------

Any ideas?

Thanks,
Rick
# Posted By Rick Germany | 6/13/07 12:04 AM
Andy's Gravatar Thanx for the post. It's useful. CF is the best :))

http://garden4u.cn
# Posted By Andy | 7/16/07 1:58 PM

Archives By Subject

Calendar

Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

Latest from MXNA

Recent Entries

No recent entries.

Recent Comments

BulletProject Tracker v2.0 Released
Joe Danziger said: @Doug - thanks, glad you like the app! You can add the following to the <cfapplication> call ... [More]

BulletProject Tracker v2.0 Released
Doug said: Great App! How can I increase the time before the session times out? thanks! [More]

BulletProject Tracker v2.0 Released
Joe Danziger said: @Ron - You can access the demo with username admin and password admin. [More]

BulletProject Tracker v2.0 Released
Ron Stewart said: Joe: from the screenshots and the blog entries, this looks pretty cool. I'd like to play in the demo... [More]

BulletProject Tracker v2.0 Released
Mike G said: very very very nice work Dan, nearly blew my load when I saw you even included an API to access ever... [More]

RSS


Search

Sponsored Links

Wimpy MP3 Player
Wimpy MP3 Player
easy streaming media
for your coldfusion site



Subscribe

Enter your email address to subscribe to this blog.

Tags

ajax coldfusion