cfmail query results in mail message

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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...
    2. 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....
    3. 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...
    4. 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...
    5. 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...
  3. #2

    Default 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

  4. #3

    Default 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

  5. #4

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139