Professional Web Applications Themes

cfmail / cfloop / query: How to make work? - Macromedia ColdFusion

Greetings - As should be done before posting, I have searched the forum for an answer and did not find one, so am posting my question / situation for pointers. That said, here is the scenario. What I am trying to accomplish, is to loop through the "Command Email" for sending the information, as well as loop through the PermitInfo to output the records to the individuals receiving the e-mails. I have been able to accomplish the loop for sending the e-mail side of things but have not figured out the process for looping through the permit information and sending ...

  1. #1

    Default cfmail / cfloop / query: How to make work?

    Greetings -

    As should be done before posting, I have searched the forum for an answer and
    did not find one, so am posting my question / situation for pointers. That
    said, here
    is the scenario.

    What I am trying to accomplish, is to loop through the "Command Email" for
    sending
    the information, as well as loop through the PermitInfo to output the records
    to the
    individuals receiving the e-mails.

    I have been able to accomplish the loop for sending the e-mail side of things
    but have not figured out the process for looping through the permit information
    and sending it out to each of the e-mail addresses.

    Thanks in advance for any assistance.

    Leonard B


    Below is the code structure I am using and works fine for sending to
    a single address, but have not figured out the looping part.

    <cfquery name="GetPermitInfo" datasource="site_testing_db01">
    SELECT RecordID, PermitNum, PermitLoc, PermitExp
    FROM BurnPermits
    </cfquery>

    <cfquery name="GetCommandEmail" datasource="site_testing_db01">
    SELECT RecordID, FirstName, LastName, EmailAddress
    </cfquery>

    <cfmail
    to="org"
    from="org"
    subject="Active Burn Permits"
    type="html" query="GetPermitInfo>


    <table>

    <tr>
    <td>Permit No.</td>
    <td>Expires</td>
    <td>Location</td>
    </tr>

    <cfoutput>
    <tr>
    <td>#PermitNum#</td>
    <td>#PermitExp#</td>
    <td>#PermitLoc#</td>
    </tr>
    </cfoutput>

    </table>

    </cfmail>











    Leonard Guest

  2. #2

    Default Re: cfmail / cfloop / query: How to make work?

    Try changing from this:
    <cfmail
    to="org"
    from="org"
    subject="Active Burn Permits"
    type="html" query="GetPermitInfo>


    <table>

    <tr>
    <td>Permit No.</td>
    <td>Expires</td>
    <td>Location</td>
    </tr>

    <cfoutput>
    <tr>
    <td>#PermitNum#</td>
    <td>#PermitExp#</td>
    <td>#PermitLoc#</td>
    </tr>
    </cfoutput>

    </table>

    </cfmail>

    To This:
    <cfmail QUERY="RECORSET_NAME"
    to="org"
    from="org"
    subject="Active Burn Permits"
    type="html" query="GetPermitInfo>


    <table>

    <tr>
    <td>Permit No.</td>
    <td>Expires</td>
    <td>Location</td>
    </tr>

    <cfoutput>
    <tr>
    <td>#PermitNum#</td>
    <td>#PermitExp#</td>
    <td>#PermitLoc#</td>
    </tr>
    </cfoutput>

    </table>

    </cfmail>

    brokerandy25 Guest

  3. #3

    Default Re: cfmail / cfloop / query: How to make work?

    Greetings -

    The code below provides the desired outcome.

    Thanks for the response brokerandy25

    =====================================

    <cfquery name="GetPermitInfo" datasource="site_testing_db01">
    SELECT RecordID, PermitNum, PermitLoc, PermitExp
    FROM BurnPermits
    </cfquery>

    <cfquery name="GetCommandEmail" datasource="site_testing_db01">
    SELECT RecordID, FirstName, LastName, EmailAddress
    </cfquery>

    <cfloop query=GetCommandEmail>
    <cfmail
    to="org"
    from="org"
    subject="Active Burn Permits"
    type="html" query="GetPermitInfo>


    <table>

    <tr>
    <td>Permit No.</td>
    <td>Expires</td>
    <td>Location</td>
    </tr>

    <cfloop query="GetPermitInfo">
    <tr>
    <td>#PermitNum#</td>
    <td>#PermitExp#</td>
    <td>#PermitLoc#</td>
    </tr>
    </cfloop>
    </table>

    </cfmail>
    </cfloop>

    Leonard Guest

Similar Threads

  1. cfmail w/cfloop
    By John in forum Macromedia ColdFusion
    Replies: 6
    Last Post: July 25th, 08:25 PM
  2. CFLOOP and CFMAIL
    By bweno in forum Macromedia ColdFusion
    Replies: 3
    Last Post: June 21st, 11:05 PM
  3. CFMail Timing Out in CFLoop
    By mpalsf in forum Coldfusion - Advanced Techniques
    Replies: 2
    Last Post: May 7th, 01:41 PM
  4. cfloop from query
    By EINN in forum Macromedia ColdFusion
    Replies: 1
    Last Post: April 18th, 02:09 PM
  5. count cfloop query
    By CFMadness in forum Coldfusion - Advanced Techniques
    Replies: 0
    Last Post: April 4th, 06:43 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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