Skip to main content
Known Participant
November 23, 2010
Question

is any way in CFML send cfmail not code but rather a page.cfm

  • November 23, 2010
  • 3 replies
  • 2820 views

is any way in CFML send cfmail not code but rather a page.cfm... one way is convert page.cfm (and server side code) to code lines and append in cfmail? if yes, how this? or any other way for first?

    This topic has been closed for replies.

    3 replies

    Inspiring
    November 24, 2010

    It's not clear what you're asking.  But here's another couple of interpretations:

    1) do you mean email the actual code?  In which case read the file with <cffile> and output it with htmlCodeFormat() in the mail body.

    2) or do you mean send the HTML that one would get if one browsed to http://yourdomain/page.cfm?  In which case use <cfhttp> to browse to it and capture the HTML, and then use that as your body.

    3) try to explain your requirements again... ;-)

    --
    Adam

    Known Participant
    November 24, 2010

    <cfmail ...><cfinclude template="page.cfm"></cfmail>

    is it the easiest method...?

    well I mean html code of email message be the page.cfm code LIKE put the html&cfm code inside cfmail tags... well?

    I do NOT mean insert to email message the html code so recipient of email read the code ....

    it will work for this the include or NOT cfml vars needed in #var# not actual cfml from scratch?

    Known Participant
    December 15, 2010

    Also put the <cfsavecontent...> block outside the mail tag, so the white space around that code is not part of the e-mail message.  EVERYTHING between the opening <cfmail...> tag and the closing </cfmail> tag, including whitespace, is going to be part of the e-mail body.

    <cfsavecontent variable="theHTML">
         <cfinclude template="index.cfm">
    </cfsavecontent>

    <cfmail from="ggggg@cytanet.com.cy" subject="Confirmation" to="gggg@cytanet.com.cy"><cfoutput>#trim(theHTML)#</cfoutput></cfmail>


    shows below with eight smaller boxes 7px square about at the top, space and after the html....boxes can not copied  

    used:

    <cfsavecontent variable="theHTML">
         <cfinclude template="index.cfm">
    </cfsavecontent>

    <cfmail from="nnn@cytanet.com.cy" subject="Confirmation" to="nnn@cytanet.com.cy"><cfoutput>#trim(theHTML)#</cfoutput></cfmail>



      
      




    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/storeTempl1.dwt" codeOutsideHTMLIsLocked="false" --> <head>
    <!-- InstanceBeginEditable name="doctitle" --><meta name="google-site-verification" content="YMuLX_G2GYYC5vHgAVqEIoOE7xw6CBU6nKOaXXuJUyE" /> <title>Home Page - PolisPhotos.com new Layout Nov. 2010</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta name="description" content="new Layout - NOV 2010 - Photo Images of Polis, Pafos  District, Cyprus" /> <meta name="abstract" content="Polis, CY Photo Prints & Downloads Online Shop" /> <meta name="keywords" content="polis photos, polis fotos, polis chrysochous, pafos photos, paphos photos, Cyprus photos, polis images, polis fotos, polis chrysochous photos, polis chrysochous images, pafos images, paphos images, Cyprus images, polis cyprus, polis holidays, polis gifts, polis photos shop, polis shop, polis online, polis shop online" /> <meta name="robots" content="index,follow" /> <meta name="distribution" content="Global" /> <meta name="author" content="L web Dev net" /> <meta name="copyright" content="All contents copyright(c) 2011 of www.polisphotos.com" /> <meta name="Resource-Type" content="Document" /> <meta name="generator" content="Dreamweaver CS4" /> <meta name="language" content="EN-US" />

    <!-- InstanceEndEditable -->

    BKBK
    Community Expert
    Community Expert
    November 23, 2010

    Just send it as a string-valued variable, for example

    <cfset myString = '<cfset x=1>
    <cfset y="two">
    <cfdocument format="PDF" name="test">
    test pdf
    </cfdocument>'>


    <cfmail>
    <cfoutput>#myString#</cfoutput>
    </cfmail>

    pete_freitag
    Participating Frequently
    November 23, 2010

    Not sure if this is what you are asking, but you might try: <cfmail ...><cfinclude template="page.cfm"></cfmail>