HTML Email Body with Loop Variables

Follow / 15 May 2018 at 6:24pm

I have an automation script that loops through a list of users and sends an email to each one.  I'd like to format the email body in HTML so that I can add a hyperlink in the email.  The email body must also be customized for each user something like: 

Hello #Loop_data_1_SQL.NAME#

Please click this link to see your results

I can get the loop variables to insert without any html formatting, and I can get the email to format in HTML but without any loop variables... Not sure how to get both. Any help appreciated!

Also, if anyone from Toad is reading this... a nice addition to the product would be to allow HTML to be input directly into the email body section.  Seems like this would be much more simple.

Replies

  • Follow / 21 May 2018 at 5:53pm

    I have not messed with the HTML formatting, but I can get hyperlinks to work in an email that uses variables.  If the hyperlink is formatted correctly (may need to be enclosed in double quotes if it has spaces in it) and has a space or carriage return after it then it gets converted to a hyperlink.  Hope that helps.

     - Greg

  • Follow / 23 May 2018 at 7:24am

    Hi Cpshort,

    If you want to use a variable content in an html file, then use the Find and replace activity. The html report might need to have a token or symbol that you know is there so you can replace the value.

    Template has NAME token. Use the Find and replace activity to find NAME and replace with #Loop_data_1_SQL.NAME#

    <html>

    <body>

             Hello NAME<br> 

            please <a href="https://community.toadworld.com/"> click this link</a> see your results

    </body>

    </html>

    In this case, you have to use two "Find and Replace" activities, one drop before Email activity to replace Name with Variable value, the other drop after Email activity to get token "Name" back so that next loop could find "Name" again.

    Cindy