7 Replies Latest reply on Sep 13, 2009 4:24 PM by dloval

    nested repeat region - multiple email recipients


      Basically what I'm trying to do is to send a email made up of a dynamic table to some email recipients (5-20) from a database table.

      This seemed like the right way to do it, but doesn't work correctly. The first email is sent correctly to the first email recipient. The second email is sent to the second recipient, but without any of the dynamic table.


      My question is: How to make so that the dynamic info gets sent to every person. Is there a better way to have the "send email" function repeat?


      It feels like I'm really close to a working solution, but have been struggling with this for a few hours without making any progress. Any help is greatly appreciated!



               <?php do { ?>
        $sectemailObj = new tNG_EmailPageSection();
        $sectemailObj->setSubject("Closing Grain bids");
            <p>Here's today's Closing Grain Bids.</p>
            <table width="400" border="0" cellpadding="3" cellspacing="0">
                  <td><h5><strong>Nearby Price</strong></h5></td>
                  <td><h5><strong>Price Change</strong></h5></td>
                  <td><h5><strong>Price on</strong></h5></td>
                  <td><h5><strong>New Crop</strong></h5></td>
                    <?php do { ?>
                        <td><?php echo $row_grain['title']; ?></td>
                        <td>$<?php echo $row_grain['price']; ?></td>
                        <td><?php echo $row_grain['price_change']; ?></td>
                        <td><?php echo $row_grain['price_on']; ?></td>
                        <td>$<?php echo $row_grain['new_crop']; ?></td>
                      <?php } while ($row_grain = mysql_fetch_assoc($grain)); ?>
      ?>                <?php } while ($row_grain_closing_bids = mysql_fetch_assoc($grain_closing_bids)); ?>

        • 1. Re: nested repeat region - multiple email recipients
          bigbutbald Level 1

          Bump. I keep banging my head against this. Anyone have any ideas?

          • 2. Re: nested repeat region - multiple email recipients

            Are you not using the Send Mail From Recordset?  I think it would apply better here.



            It will allow you to build the list and send any data, on the page or otherwise, It generally works fine for muti emails for me.


            Please let me know if I didn't understand the problem.



            1 person found this helpful
            • 3. Re: nested repeat region - multiple email recipients
              bigbutbald Level 1

              I have a "send page section by email" function, that repeats itself, drawing email addresses from a database table.

              Inside that page section is a table, with a repeating <tr> that has info from another database table. (crop, price, etc)


              What happens is in the first email, everything is sent fine, including the repeating region inside the <tr>.


              The following emails are sent to the correct email recipients, pulled from the first database table. However the repeating <tr> doesn't work any longer. It's like after the first email is sent it the <tr> repeating region, just stops repeating.

              • 4. Re: nested repeat region - multiple email recipients
                zzipper7 Level 1

                Well my first though w/o getting to deep into the ADDT functions is that the repeat region is not executing your content.


                As you have probably tried before, you can't have (w/o some custom code) duplicate repeat regions, so when your code executes it doesn't see the content past the first run.


                If it’s the emails, then it has to be a syntax error in one or more of the email address..like a space or comma or something interrupting the code.


                I have done what you are describing on several occasions, but I used "for each" functions or modified my "while" statement so that my repeat regions function properly.


                If you are using the ADDT Nested region, I doubt it’s the content causing the issue, the send mail content portion is fairly flexible on this.. but the send mail addresses is a bit more particular.


                Since it only takes 30 seconds to build a new page with a recordset, may I suggest you try making a "send mail by recordset" from the toolbox functions to check your email address and email function. If you get success..add a simple nested region and see if it fails.


                If you're still stuck, I'm avail 6PM EST US  we can PM and I'll do a trial run from here on one of my existing set ups.


                I hope this is useful info.


                Maybe Gunter will catch this one before then, he really knows the limits of the functions and could tell you for sure if there is a conflict.






                1 person found this helpful
                • 5. Re: nested repeat region - multiple email recipients
                  bigbutbald Level 1

                  The emails get sent correctly. It's the repeating region in the email content that doesn't show after the first email. I think I may not have communicated what my problem is, as well as I could have.



                  The first email looked like this:

                  Nearby Price
                  Price Change
                  Price on
                  New Crop
                  Hard Wheat$6.25+0.1806/05/09$



                  the following emails look like this:


                  Nearby Price
                  Price Change
                  Price on
                  New Crop



                  Anyway,  I fixed the problem when I inserted this code:

                  $rows = mysql_num_rows($Recordset1);
                  if($rows > 0) {
                  mysql_data_seek($Recordset1, 0);
                  $row_Recordset1 = mysql_fetch_assoc($Recordset1);


                  This makes so the <tr> repeats again and again, not just in the first email.


                  Thanks for your help! Your replies were very helpful!

                  • 6. Re: nested repeat region - multiple email recipients
                    zzipper7 Level 1

                    No problem,  that fix you have there is one the "while" statements that I've had successes with..I'm glad you got it, it's so annoying when you are so close and you know it's something easy..congrats!




                    • 7. Re: nested repeat region - multiple email recipients

                      I am actually trying to do the exact same thing, but I am not sure where you inserted the code you described. Could you let me know where to add the code, or if its not too much trouble post an example code page?