Skip to main content
December 2, 2008
Question

Evaluate

  • December 2, 2008
  • 3 replies
  • 614 views
I am trying to create an easy way to maintain some emails we sent out on a regular basis. I have setup a table to store the data for the 7 or so emails we have. All the emails have HTML inside them and also has variables that needed to be processed. When I try to evaluate the body of the email (that contains html coding and variables), the evaluate stops at all the "<" signs and gives an error stating that this is the beginning of a cold fusion tag and will not continue.

My question is, how can I evaluate a block of html code with variables needing processed without receiving an error?

Thanks.
    This topic has been closed for replies.

    3 replies

    Participating Frequently
    December 9, 2008
    You need to do as Dan suggested. Store the email bodies in separate files and store the file location in your database. This doesn't prevent you from, as you say:
    "...so editing is very fast and easy - with menus."

    Just use <cffile> to read and write the contents of the files. And when you're sending your emails, use <cfinclude>

    You can't dynamically evaluate coldfusion code, which is what you're trying to do. You want to be able to do something like this:
    Evaluate("<b>Hello #firstname#!</b> Thanks for requesting our newsletter!! Today's date is #now()#")
    That won't work, as you've found out. The only way to accomplish this currently is to write that string to a file, then <cfinclude> that file.
    Inspiring
    December 9, 2008
    What happened when you simply outputted the html stuff from your db without trying to evalutate it?
    Inspiring
    December 3, 2008
    You are probably better off storing the info in files and putting the file locations in your db. Then you can use things like cfsavecontent or cfinclude and things will just work.
    December 3, 2008
    I would rather have all the information pulled from a table on the fly, so editing is very fast and easy - with menus. There ought to be a way to use evaluate with html coding together.

    Anyone have any solutions?

    Thanks.
    Inspiring
    December 3, 2008