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

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

New Here ,
Nov 23, 2010 Nov 23, 2010

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?

2.4K
Translate
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
Enthusiast ,
Nov 23, 2010 Nov 23, 2010

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

Translate
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
Community Expert ,
Nov 23, 2010 Nov 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>

Translate
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
LEGEND ,
Nov 24, 2010 Nov 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

Translate
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
New Here ,
Nov 24, 2010 Nov 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?

Translate
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
LEGEND ,
Nov 24, 2010 Nov 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

Translate
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
New Here ,
Dec 14, 2010 Dec 14, 2010

<cfmail from="

ayyyyy@cytanet.com.cy" subject="Confirmation" to="ayyyyy@cytanet.com.cy "> <cfhttp url="notify.cfm"/></cfmail>

I used this but getting an empty body email message...

Translate
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
LEGEND ,
Dec 14, 2010 Dec 14, 2010

Ask yourself the question... does <cfhttp> output anything?

--

Adam

Translate
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
New Here ,
Dec 14, 2010 Dec 14, 2010

well as (5 reply) suggest use cfhttp, to appear in email body not code, but what you see if you browse to notify.cfm, well how handle? I get confused in Adobe cf doc cfhttp...

Translate
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
LEGEND ,
Dec 14, 2010 Dec 14, 2010

I get confused in Adobe cf doc cfhttp...

In what way?

<cfhttp> gets the CF server to perform an HTTP request (so like a browser hitting the page).  <cfhttp> returns a struct with a bunch of keys in it, reflecting the result of the request: and one of the keys returns to HTML from the request.

Have you experimented making a <cfhttp> call, and are having difficulty getting it to work?

--

Adam

Translate
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
New Here ,
Dec 14, 2010 Dec 14, 2010

I experimented and failed , how handle if page returned in email is yyy.cfm? may be and yyy.html if no cfm vars in?

Translate
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
New Here ,
Dec 14, 2010 Dec 14, 2010

If I'm understanding your problem correctly, you have to "read" the file by cfhttp, then assigns the content returned to a variable.

Then output this variable in your cfmail tag.

If the CFHTTP is not returning anything, then you need to look at why not.

Or maybe, you can use...

<cfsavecontent variable="theHTML">

     <cfinclude template="thePage.cfm">

</cfsavecontent>

and use "theHTML" as a variable in your email.

This might only work depending upon how you're doing things.

Translate
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
New Here ,
Dec 14, 2010 Dec 14, 2010

<cfmail from="ggggg@cytanet.com.cy" subject="Confirmation" to="gggg@cytanet.com.cy">
<cfsavecontent variable="theHTML">
     <cfinclude template="index.cfm">
</cfsavecontent>
<cfoutput>#theHTML#</cfoutput>
</cfmail>

i try but rather content shows code in email of index.cfm, but after 25cm of white vertical space...

Translate
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
New Here ,
Dec 14, 2010 Dec 14, 2010

This is because you are probably not making much use of and so

cldfusion is displaying every whitespace character it processes.

As a way around this, surround it with...

#trim(the_variable_with_lots_of_whitespace)#

that should work

Phil

Translate
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
Valorous Hero ,
Dec 14, 2010 Dec 14, 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>

Translate
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
New Here ,
Dec 15, 2010 Dec 15, 2010

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 -->

Translate
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
LEGEND ,
Dec 15, 2010 Dec 15, 2010

At some point you will probably be wanting to set the type attribute of cfmail to html.  Now seems as good a time as ever.

Translate
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
New Here ,
Dec 15, 2010 Dec 15, 2010
LATEST

worked with type="html"

Translate
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