Best practice creating an email list in coldfusion

Posted on 2012-08-27
Last Modified: 2012-08-27
Hello Experts,

I am trying to create an email list in a coldfusion page, The page user selects checkboxes on the page so he can email different email groups and users. Some checkboxes are created and populated via cfloops wherein the values are dynamic and harvested from a database table, and other checkboxes are static and their values are hard coded on the page.

I have tried to cfset an email list that appends depending on which checkboxes are selected. I cannot seem to get a space after the comma for cfmail to properly use the cfset list.

Any help will be greatly appreciated.
Question by:CementTruck
    LVL 13

    Accepted Solution

    >> I cannot seem to get a space after the comma for cfmail to properly use the cfset list.

    you don't need that

    you can pass the list like,

    Author Comment

    really??!! In that case my work here is done! I've had issues in the past where CFmail was very finicky about how the recipient list was formatted and the space was always a necessary thing. If you're right, then my cfset/append is good to go. I'll test it in a little bit after I finish the db insert code. I'll let you know how it turns out.

    In the meantime, if you, or anyone else, has a more elegant solution for creating an email list I'd like to hear it.

    LVL 13

    Assisted Solution

    Yes you don't need space if at all you want space you can just change your append logic like this
    <cfset emaillist = "">

    loop through ur form varibles

    <cfif len(emaillist)>
    <cfset emaillist = emaillist & ", "&><!---there is a space after comma --->
    <cfset emaillist =>

    closeloop of ur form fields
    LVL 51

    Expert Comment

    > I have tried to cfset an email list that appends depending on
              > which checkboxes are selected.

    I'm curious why you need cfset at all. If you give all the checkboxes the same name the checked values are automatically submitted as a nicely formatted list.

    Author Comment


    I have two sets of checkboxes. One of them is a list of email groups that is hardcoded, and the second is a list of "currently active locations" email addresses that is headed by a "select all" checkbox. They have to be separate and I need to be able to parse the info from the "currently active locations" boxes.

    Author Closing Comment

    This worked. I guess all I needed to do was try.

    Thanks all.
    LVL 51

    Expert Comment

    It still applies mostly.  But you know more about the requirements ie if they really must be separate.

    I try not to hard code. If you have a choice about it, I'd make it dynamic. Put the hard coded values in a table. Use a query on the action page to pull the values and create a list with valueList. Very simple. No fuss, no muss.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math ( While this method is not o…
    Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them ( . I did keep the main js functions but made sever…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now