• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Newsletter Templates

Explorer ,
Jun 15, 2006 Jun 15, 2006

Copy link to clipboard

Copied

I have created a newsletter template which resides in a database table, now within this newsletter I want to do a query ouput, since I know I can't nest cfoutput tags I created cfloops and call the queries but this is not work. My goal is for the users to create their own newsletter templates without having to insert the content but instead populate the content from the database any help anyone can offer with be greatly appreciated.
TOPICS
Advanced techniques

Views

222

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 15, 2006 Jun 15, 2006

Copy link to clipboard

Copied

LATEST
OK I figured out the answer. You first do a cffile function to write the contents of the template from the database, then with your cfmail call you do a cfinclude for the file you just wrote. This way you can do any types of cfloops and cfoutputs you want without a worry or copromising any type of security. Then after your cfmail call you do a cffile action="detele" to remove the file from the directory and you are done.

<cfset filePath = #GetDirectoryFromPath(ExpandPath("."))#&"cms\newsletter_files\"&#sendnews.temp_name#&".txt">
<cffile action="write" file="#filePath#" output="#sendnews.temp_copy#" />
<cfmail to="test@123.com" from="test@test.com" Subject="test email" replyto="test@test.com" type="html" spoolenable="yes">
<cfinclude template="newsletter_files/#sendnews.temp_name#.txt">
</cfmail>
<cffile action="delete" file="#filePath#">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation