Skip to main content
Inspiring
September 16, 2011
Question

Store contents of <CFMAIL> into CLOB database field

  • September 16, 2011
  • 2 replies
  • 720 views

Hi All,


I have a requirement where I have to store the contents of my <cfmail> body text into a clob database field.  Does anyone know how I can go about achieving this ?  My cfmail could contain certain variables, cfincludes and maybe even cfif's in the body content.

Below is a extract of one of my <cfmails> any help would be much appreciated.

<CFMAIL>

<strong>LOST ID REQUEST</strong>

<p>

Your ID is: <strong>#attributes.PK#</strong>

</p>

<p>

To login to the system, go to: <a href="http://www.blah.com">www.blah.com</a>

</p>

<p>

<cfinclude template="include.cfm">

</p>

<p>

Regards<br />

George<br />

</p>

<p>

(email generated #DateFormat(now(),"dd-mmmm-yyyy")# at #TimeFormat(now(),"h:mm tt")#)

</p>

</CFMAIL>

    This topic has been closed for replies.

    2 replies

    _G_1Author
    Inspiring
    September 16, 2011

    Ignore my last request, a cfoutput did the trick

    Owainnorth
    Inspiring
    September 16, 2011

    Yup, CFSAVECONTENT is your friend.

    <cfsavecontent variable="x">

      Stuff goes here: loops, outputs, vars etc

    </cfsavecontent>

    <cfquery>

      INSERT INTO whatever VALUES <cfqueryparam cfsqltype="cf_sql_clob" value="#x#" />

    </cfquery>

    <cfmail>

    #x#

    </cfmail>

    Pow pow pow.

    _G_1Author
    Inspiring
    September 16, 2011

    Thank you for the great respone Owain!

    I have tested it and it works great, but I have one problem though.

    Is there anyway instead of inserting the following into the database  "Your ID is: <strong>#attributes.PK#</strong>" it gets inserted with this "Your ID is: 1"

    I hope I am making myself clear.