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?

    Inspiring
    November 24, 2010

    OK, I understand what you need now.


    If you want to send in the email what a person would see if they browsed to http://yourdomain/page.cfm, then you have to <cfhttp> it, you cannot simply include it.  Because the two are rather different processes.

    --
    Adam

    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>