Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
jasun123 #1
cfmail query results in mail message
I am working on an alarm mail system that will send emails when data values in
a DB reach or exceed certain values... I can put cfmail query="last_6hr" and
the email will send but the format is bad... I need the email message to have
a certain format with the results of a query outputed in the message.... If i
don't use the cfmail tag it outputs to the html window formatted properly....
Here is the generalized code and error stmts.......
<cfloop query="constraint">
etc...
etc....
<cfquery
select *
from table
where blah=#constraint.g_id#
<cfquery>
etc...
etc...
<cfset fail="SOMETHING">
etc...
etc...
<cfmail
to="me@here.com"
from="ColdFusionMX Alarm"
subject="#Fail# Alarm was activated for the gage #id.loc#-#id.river#">
<cfmailpart type="text">
<cfoutput>
The Following #Fail# Alarm
was activated for the gage
#id.loc#-#id.river#
</cfoutput>
<cfoutput> </cfoutput>
<cfoutput>#constraint.g_id#, #constraint.lev#, #variables.ver#</cfoutput>
<cfoutput>::: #fail# ALARM(S) :::</cfoutput>
<cfoutput> </cfoutput>
<cfoutput query="last_6hr">#last_6hr.dt# #last_6hr.val#<br></cfoutput>
<cfoutput>Please check limits to see if mitigation is necessary!</cfoutput>
<cfoutput> </cfoutput>
</cfmailpart>
</cfmail>
The result:
Invalid tag nesting configuration.
A query driven CFOUTPUT tag is nested inside a CFOUTPUT tag that also has a
QUERY= attribute. This is not allowed. Nesting these tags implies that you want
to use grouped processing. However, only the top-level tag can specify the
query that drives the processing.
The error occurred in /var/apache/htdocs/cf/realtime/warn/mail_warn.cfm: line
112
110 : <cfoutput>::: #fail# ALARM(S) :::</cfoutput>
111 : <cfoutput> </cfoutput>
112 : <cfoutput query="last_6hr">#last_6hr.dt# #last_6hr.val#<br></cfoutput>
113 : <cfoutput>Please check limits to see if mitigation is
necessary!</cfoutput>
114 : <cfoutput> </cfoutput>
How do you get <cfoutput query="last_6hr"> type results mixed with looped
query results in an email message??????
jasun123 Guest
-
Grouping results in CFMAIL
Hi there, I am using MX7 and trying to send a mail that contains the content of a grouped query, grouping the results by date like this: Date1... -
cfmail query using form for input of message
There must be a way to do this--to search for a group who is to receive the email, let a user create a form message, and send to all those users.... -
query results in cfmail
I want to show an itemized invoice based on a query, and send it in cfmail. Whenever I specify a query, it only returns the first row. Any... -
Query results don't display properly in results table.IGNORE PREVIOUS
:disgust; I need to display the results of a query. The query runs properly. My problem is having specific results display in specific locations in... -
Query results don't display properly in results table.
:disgust; I need to display the results of a query. The query runs properly. My problem is having specific results display in specific locations in... -
OldCFer #2
Re: cfmail query results in mail message
You don't really need all of those cfoutput tags. Is there another cfoutput tag enclosing
the cfmail tag, that's not shown?
OldCFer Guest
-
jasun123 #3
Re: cfmail query results in mail message
Yeah, I know.... It is the way I try to make coldfusion generate text output
instead of html... sure there is a better way to do it, but that is besides
the point...
In regards to an open cfoutput tag, no i do not have any open... If I comment
out the cfmail stuff it creates the page in a webbrowser and works fine....
jasun123 Guest
-
dempster #4
Re: cfmail query results in mail message
It looks like you are making this too complicated. Instead of sending a
multi-part email, just use the CFMAIL tag and don't specify a type. The default
is plain text, and all white space and newlines between CFMAIL and /CFMAIL will
appear in the body of the email.
The other options is to use TYPE="HTML" and then format the ouptut with HTML
tags such as <BR> and <P> or with an HTML table to lay things out in a
particular way.
You definitely don't want all those CFOUTPUT tags inside the CFMAIL.
ColdFusion does not generate HTML - the output is whatever you tell it to be,
whether plain text of HTML tags.
-Paul
dempster Guest



Reply With Quote

