[thelist] Email this page

Joshua Olson joshua at waetech.com
Mon Dec 16 11:26:01 CST 2002


----- Original Message -----
From: "Hershel Robinson" <hershelr at netvision.net.il>
Sent: Monday, December 16, 2002 10:22 AM


> Is anyone aware of a simple, pre-packaged script that can add "email this
> page" functionality to any page.  I have more than one client that would
> like this.  All I want is a link on each page and clicking the link either
> opens up a little window or takes the user to a new page and from this new
> page/window, the user can enter his email and name and his friend's email
> and name and send it off.

Hershel,

Setting up an external script to do this may be simple depending on the
platform.  The basic concept would be something like this, in Cold Fusions:

~~~~~~~~~~~~~~~~~~~~~~~ page to be sent

<html>

...
<body>
...
  <a
href="/email_page.cfm?href=#URLEncodedFormat(url_of_this_page)#&email_to="
onclick="top.location.href = this.href + escape(prompt('Who do you want to
send this to?')); return false;">Email this page</a>
...
</body>

</html>

~~~~~~~~~~~~~~~~~~~~~~~ email_page.cfm

<cfparam name="url.href" default="">
<cfparam name="url.email_to" default="">
<cfhttp url="#url.href#" method="GET" resolveurl="false"></cfhttp>
<cfmail to="#url.email_id#" from="whatever at whatever.com" subject="Somebody
sent this to you.">#cfhttp.filecontent#</cfmail>

The email has been sent.
<cfabort>


Note: this above code is untested, but the basic concept will work.  For JS
enabled users, they will be prompted to supply a send-to email address when
they click the link.  Non-JS users will not.  However, you could build the
logic into the page that actually does the emailing to prompt the user for
the destination email address if one wasn't supplied.  It should be fairly
simple to turn the anchor into a form as necessary.

HTH,

-joshua




More information about the thelist mailing list