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.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.
Archived Comments
Sweet. We sometimes forget how powerful (and simple) CFMX can be. I'd suggest sending them (Mailenable.com) the code to use alongside their ASP and PHP examples.
By the way, your link to CFCZone in this post is not complete.
Should be fixed now. Thanks for the warning.
Fantastic stuff...I was scratching my head about this very issue over the last few days, but forgot to include COM objects in my thinking. Thanks for the tip.
Could you also just send a subscription email from cfmx to mailEnable to do the same thing??
Yes, and that was going to be my first try - till I noticed the API documentation.