Working with MailEnable and ColdFusion

This blog (and the sites here, CFLib, CFCZone, RSSWatcher) all use MailEnable for their mail server. I was setting up a new listserv today (more on that later) and was wondering if there was a way to let ColdFusion add a list member. I figured I’d probably have to append to some text file - but I was worried about the potential issues that could cause. Turns out - ME actually has a COM interface. All their demos are in ASP and PHP (sigh), but I was able to add a member using the code below:

<cfset mel = createObject("com", "MEAOLS.ListMember")>
<cfset mel.AccountName = "acadianammug.org">
<cfset mel.ListName = "LafayetteTech">
<cfset mel.ListMemberType = 1>
<cfset mel.Status = 1>
<cfset mel.Address = "[SMTP:" & trim(form.addmember) & "]" >
<cfset result = mel.AddListMember()>

If the result is 1, then everything worked fine. The only odd thing is that a user added this way will not get a confirmation email. Therefore, I just send them an email myself.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments