Skip to main content
Participant
May 5, 2016
Question

cfmail sending to first email address in query only

  • May 5, 2016
  • 3 replies
  • 350 views

When attempting to send an email to multiple recipients using Cold Fusion, only the first row is receiving the email and it seems to be being hit three times but only sending once. This works but all recipients are visible and the cfoutput is displayed as many times are there are recipients:

<cfmail to = "#ValueList(getEmail.Schd_Email)#" from="test@test.edu" subject="This is a Test" type="HTML" query="getEmail" failto="test@test.com"> The location has been moved to <b><cfoutput>#location#</cfoutput></b><br/> </cfmail> 

This only sends to the first person listed in the query and the cfoutput in the body is still listed as many times as there are recipients.

<cfmail to = "#Schd_Email#;" from="test@test.edu" subject="This is a Test" type="HTML" query="getEmail" failto="test@test.com"> The location has been moved to <b><cfoutput>#location#</cfoutput></b><br/> </cfmail> 

I can output the query to the page and see all emails listed. Not sure why the latter does not work. Any ideas?

This topic has been closed for replies.

3 replies

WolfShade
Legend
May 9, 2016

There is a chance that the email server may not allow commas as separators for email addresses.  If this is the case, then you'll need to add an argument to valuelist() setting the semi-colon as the delimiter.

valuelist(query.column, ';')

HTH,

^_^

BKBK
Community Expert
Community Expert
May 7, 2016

Do something like this:

<cfmail query="getEmail"

        from="test@test.edu

        type="HTML"

        to="#getEmail.Schd_Email#"

        subject="This is a Test"

       failto="test@test.com">

<cfoutput>

#getEmail.someColumnName#

etc. etc.

</cfoutput>

</cfmail>

BKBK
Community Expert
Community Expert
May 6, 2016

Could you show us the entire code, including any cfoutput tags?