Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 350
  • Last Modified:

Best practice creating an email list in coldfusion

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.
0
CementTruck
Asked:
CementTruck
  • 3
  • 2
  • 2
2 Solutions
 
srikanthmadishettiCommented:
>> 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 test@test.com,test1@test.com....
0
 
CementTruckAuthor Commented:
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.

Thanks.
0
 
srikanthmadishettiCommented:
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 & ", "&form.email><!---there is a space after comma --->
<cfelse>
<cfset emaillist = form.email>
</cfif>

closeloop of ur form fields
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
_agx_Commented:
> 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.
0
 
CementTruckAuthor Commented:
@_agx_,

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.
0
 
CementTruckAuthor Commented:
This worked. I guess all I needed to do was try.

Thanks all.
0
 
_agx_Commented:
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.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now