Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7998505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:13:42+00:00 2026-06-04T15:13:42+00:00

For CFMail – I am building a To: list and BCC: list using cfset

  • 0

For CFMail – I am building a To: list and BCC: list using cfset tolist and cfset bcclist

These output just fine. But when I add them into the cfmail – the tolist and bcclist error.

I am not sure why, as they are just comma delimited lists.

Get:
The value of the attribute to, which is currently emailthis@gmail.com,emailthat@gmail.com,emailagain@gmail.com is invalid.

When I hard code in the above list – it works just fine.

The alist and clists below create just fine, and look just fine to me.
I can’t seem to find a solution to what I’m doing wrong.

 <cfoutput>
 <cfif isdefined("form.checkbox1")><cfset clist = "#checkbox1#"></cfif>
 <br><br>Check List #clist#
 </cfoutput>

 To:
 <cfset tolist = "#clist#,<cfif alist is not "">#alist#,</cfif><cfif len(other)>#other#</cfif>">
 <cfoutput>#tolist#</cfoutput>

 BCC List - basically the same

 <cfoutput>
 <cfmail type="html" from="bob@bob.com" to="#tolist#" bcc="#bcclist#" mimeattach="#pdfpath#file.pdf" subject="File.pdf">

 Blahhh
 </cfmail>
 </cfoutput>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:13:44+00:00Added an answer on June 4, 2026 at 3:13 pm

    I would suggest re-writing your code to scope your variables and also to remove the if statements from inside the cfset statements. Also, I’m assuming this isn’t all of your code since tolist and bcclist are never set anywhere. Try the code below.

    <cfset tolist = '' />
    <cfset bcclist = '' />
    <cfoutput>
     <cfif StructKeyExists(form,'checkbox1')>
      <cfset clist = form.checkbox1 />
     </cfif>
     <br><br>Check List #clist#
    </cfoutput>
    
    To:
    <cfif Len(Trim(alist))>
     <cfset tolist = ListAppend(tolist,alist) />
    </cfif>
    <cfif Len(Trim(other))>
     <cfset tolist = ListAppend(tolist,other) />
    </cfif>
    
    <cfoutput>#tolist#</cfoutput>
    
    <cfmail type="html" from="bob@bob.com" to="#tolist#" bcc="#bcclist#" mimeattach="#pdfpath#file.pdf" subject="File.pdf">
    Blahhh
    </cfmail>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using CFMAIL to send out an email. For some reason, when I edit
I have a huge delay when sending email (1-2 hours) using cfmail. Is there
I'm sending an email using the cfmail tag, and trying to attach a PDF
I've searched the web to try to learn what I'm missing, but I just
How do you do the following using cfscript? <cfmail from=me@domain.com to=you@domain.com subject=Attachments> <cfmailparam name=Reply-To
CFMail was working fine on coldfusion 9. Then suddenly it stopped sending the email.
I'm using custom SMTP servers and would like to verify the connection when user
I am sending an HTML email that contains an image with cfmail. In summary
I've got a list of email addresses that an email is sent to. The
Consider a list o emails: ['a@amail.com','b@bmail.com','c@cmail.com',...] I want to compare list items with each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.