• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

cfmail loop query

New Here ,
Dec 18, 2006 Dec 18, 2006

Copy link to clipboard

Copied

can some one help me with this query please

i have a cfmail running off a query


i want to be able to send mail to a list of recipietns from my database

the query below works but only sends emails to the first contact in the list

what can i do to my query to change this?

<CFQUERY datasource="#application.ds#" Name="GetSch">
SELECT cc.Code, gg.PlayerPhone, dd.Message, cc.Club_Abbrev
FROM appoint_table dd, SMS_Players_Table gg, SMS_Clubs_Table cc
WHERE ServerSMS <= #CreateODBCDateTime(Now())# AND dd.App_ClientID = gg.PlayerID AND dd.LoginID = cc.ClubID
AND ServerSMS <> ''
</cfquery>

<cfmail to = "craig_mac@bigutton.com.au" query="GetSch"
from = "test"
subject="">

to:#Code##PlayerPhone#
text:#Message#
from:#Club_Abbrev#
</cfmail>
TOPICS
Advanced techniques

Views

545

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 18, 2006 Dec 18, 2006

Copy link to clipboard

Copied

Your query does not look like it's selecting any email addresses.

Your cfmail tag has a constant in the to attribute and will probably crash since the from attribute does not have a valid email address as it's value.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 18, 2006 Dec 18, 2006

Copy link to clipboard

Copied

ok thank i just realised what i need

just to go to one email as the cfmail is at the min

but i need to loop through the mail output so it send 30 emails to the same email

with the different
to:#Code##PlayerPhone#
text:#Message#
from:#Club_Abbrev#

for each record retreved form the query

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 19, 2006 Dec 19, 2006

Copy link to clipboard

Copied

LATEST
Do not use a query attribute in your cfmail tag. Put a cfloop in the part where you compose your mail body.

Alternatively, use cfsavecontent to build your mail body and stick the resulting variable into the tag. That's the method I use.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation