?
Solved

Help with CFMAIL sending just one record from the query.

Posted on 2003-03-17
4
Medium Priority
?
188 Views
Last Modified: 2013-12-24
I am using CFMAIL to send a report automatically.  In my testing I have set up two records in the table that the mail query looks at to populate the body of the email.

Problem is that the email contains just one of the records.
How do I change my code to send an individual all the records associated to that person?

Here is my simple code:

<cfloop query="get_mail">
  <cfmail to="#email#" cc="#pmemail#" from="me@me.com" subject="Overdue Assessment" type="HTML">

<!--  body of the email here -->

</cfmail>
</cfloop>
0
Comment
Question by:g118481
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 8

Accepted Solution

by:
TallerMike earned 200 total points
ID: 8155386
<cfoutput query="get_mail" group="email">
 <cfmail to="#email#" cc="#pmemail#" from="me@me.com" subject="Overdue Assessment" type="HTML">

  <cfoutput>List the overdue Assessment here...</cfoutput>
<!--  body of the email here -->

</cfmail>
</cfoutput>

Use the GROUP attribute to spit out one email per email address. Then do an inner CFOUTPUT loop to loop through the assessments that are overdue.
0
 
LVL 1

Expert Comment

by:Noodles22
ID: 8155833
<cfmail query="get_mail"to="#email#" cc="#pmemail#" from="me@me.com" subject="Overdue Assessment" type="HTML">
<!--  body of the email here -->
</cfmail>

Your cfloop code should work the same as above, but you might want to check that your query is returning more than one record

<cfdump var="#getmail#">
0
 
LVL 1

Expert Comment

by:Wasistdas
ID: 8156299
<cfloop query="get_mail">
 <cfmail to="#email#" cc="#pmemail#" from="me@me.com" subject="Overdue Assessment" type="HTML">

Dear #person#,

Here are your records associated with you:

<cfquery name="your_records">
select * from records
where person='#person#'
</cfquery>
#your_records.records#<br>

</cfmail>
</cfloop>
0
 
LVL 17

Expert Comment

by:anandkp
ID: 8164387
what u cdl also do is

<CFSET x = "">

<cfquery NAME="get_mail">
    select ......
</CFQUERY>

<cfloop query="get_mail">
    <CFSET x = "#table_FieldName#"><!--- u can use multiple text along with htmls for formatting as well - put everything in "x" for all the records the user has --->    
</CFLOOP>

then send him one mail with all records - instead of multiple emails of all records !

<cfif x NEQ "">
    <cfmail to="#email#" cc="#pmemail#" from="me@me.com" subject="Overdue Assessment" type="HTML">
    Dear #name_of_person#
   
        #x#
   
    thanx
    #admin_Name#
    </cfmail>
</CFIF>

let me know

K'Rgds
Anand
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

800 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