0
CFMail output query
New Here
,
/t5/coldfusion-discussions/cfmail-output-query/td-p/325613
Mar 24, 2009
Mar 24, 2009
Copy link to clipboard
Copied
I am coding a site where visitors select several items for
which they can request a quote. In addition, I have a form where
they insert their email address and an optional comment. The list
of items along with the optional comment is then emailed to the
company.
My problem is that the comment is being repeated the same number of times as there are items in the quote list.
How can I get the comment to display only one time?
Here is a sample of what my email looks like. You can see the Comments are repeated three times:
Please send quotes on the following items:
1004 - Saurer RC-100 winders
1005 - Evilo 6 spindle autodoff winder
1006 - Hanslong 54" centrifugal extractor
Comments: When can I see these?
Comments: When can I see these?
Comments: When can I see these?
My problem is that the comment is being repeated the same number of times as there are items in the quote list.
How can I get the comment to display only one time?
Here is a sample of what my email looks like. You can see the Comments are repeated three times:
Please send quotes on the following items:
1004 - Saurer RC-100 winders
1005 - Evilo 6 spindle autodoff winder
1006 - Hanslong 54" centrifugal extractor
Comments: When can I see these?
Comments: When can I see these?
Comments: When can I see these?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/cfmail-output-query/m-p/325614#M29411
Mar 24, 2009
Mar 24, 2009
Copy link to clipboard
Copied
i do not think you need the QUERY="SendQuote" attribute in
your <cfmail>
tag. remove it, and instead do <cfoutput query="SendQuote"> in the body
of the tag to output the requested items.
the QUERY attribute of <cfmail> tag is really only useful when that
query pulls multiple email addresses to send the mail to, and possibly
different email content for each recipient... this is not the case in
your case...
plus, <cfmail> tag acts akin to <cfoutput> tag, so you do not need to
put <cfoutput> in the mail body for cf to evaluate your variables
(unless you need to output data from a query, but even then you can just
use <cfloop query="..."> instead of <cfoutput query="...">)
see if this code works as you need:
<cfmail
to="marcia@sales.com"
from="#Getemail.email#"
subject="Quote request from #Getemail.FirstName# #Getemail.lastname#"
server="mail.sales.com"
type="HTML">
<table>
<tr><td>Please send quotes on the following items:<br><br></td></tr>
<cfoutput QUERY="SendQuote">
<tr>
<td><strong>#SendQuote.SKU#</strong> - #SendQuote.ItemName#</td>
</tr>
</cfoutput>
<cfif len(trim(form.comments))>
<tr><td><br><br><strong>Comments:</strong></td></tr>
<tr><td>#form.comments#</td></tr>
</cfif>
</table>
</cfmail>
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
tag. remove it, and instead do <cfoutput query="SendQuote"> in the body
of the tag to output the requested items.
the QUERY attribute of <cfmail> tag is really only useful when that
query pulls multiple email addresses to send the mail to, and possibly
different email content for each recipient... this is not the case in
your case...
plus, <cfmail> tag acts akin to <cfoutput> tag, so you do not need to
put <cfoutput> in the mail body for cf to evaluate your variables
(unless you need to output data from a query, but even then you can just
use <cfloop query="..."> instead of <cfoutput query="...">)
see if this code works as you need:
<cfmail
to="marcia@sales.com"
from="#Getemail.email#"
subject="Quote request from #Getemail.FirstName# #Getemail.lastname#"
server="mail.sales.com"
type="HTML">
<table>
<tr><td>Please send quotes on the following items:<br><br></td></tr>
<cfoutput QUERY="SendQuote">
<tr>
<td><strong>#SendQuote.SKU#</strong> - #SendQuote.ItemName#</td>
</tr>
</cfoutput>
<cfif len(trim(form.comments))>
<tr><td><br><br><strong>Comments:</strong></td></tr>
<tr><td>#form.comments#</td></tr>
</cfif>
</table>
</cfmail>
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Advocate
,
/t5/coldfusion-discussions/cfmail-output-query/m-p/325615#M29412
Mar 24, 2009
Mar 24, 2009
Copy link to clipboard
Copied
I believe you're getting this problem because you've
associated a query with CFMAIL that isn't needed. Change CFMAIL to
this:
<cfmail
to="marcia@sales.com"
from="#Getemail.email#"
subject="Quote request from #Getemail.FirstName# #Getemail.lastname#"
server="mail.sales.com"
type="HTML">
<table>
<tr><td>Please send quotes on the following items:<br><br></td></tr>
<cfoutput query="Sendquote">
<tr>
<td><strong>#SendQuote.SKU#</strong> - #SendQuote.ItemName#</td>
</tr>
</cfoutput>
</table>
<br><br>
<cfoutput>
<table><tr><td><strong>Comments:</strong> #Form.Comments#</td></tr></table>
</cfoutput>
</cfmail>
I typically use the query attribute of the CFMAIL tag when I am emailing to a list that I got from the DB.
Hope that helps!
<cfmail
to="marcia@sales.com"
from="#Getemail.email#"
subject="Quote request from #Getemail.FirstName# #Getemail.lastname#"
server="mail.sales.com"
type="HTML">
<table>
<tr><td>Please send quotes on the following items:<br><br></td></tr>
<cfoutput query="Sendquote">
<tr>
<td><strong>#SendQuote.SKU#</strong> - #SendQuote.ItemName#</td>
</tr>
</cfoutput>
</table>
<br><br>
<cfoutput>
<table><tr><td><strong>Comments:</strong> #Form.Comments#</td></tr></table>
</cfoutput>
</cfmail>
I typically use the query attribute of the CFMAIL tag when I am emailing to a list that I got from the DB.
Hope that helps!
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
mfitz
AUTHOR
New Here
,
LATEST
/t5/coldfusion-discussions/cfmail-output-query/m-p/325618#M29415
Mar 24, 2009
Mar 24, 2009
Copy link to clipboard
Copied
PERFECT!!!!
Thanks so much.
Thanks so much.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

