Dasher,

We use a pop-up window and ask the user for
their name, email and their friend's email --
check for obvious email formatting problems
and then send the email.

Using a FORM image or FORM button will allow
you to capture the template name (page name)
and add it to a hidden variable in the pop-up
window so you can send the URL in the email
also.

Here's a simple example:

link code:

<form action="http://www.yoursite.com/tellfriend.cfm";
target="popw"
onSubmit="window.open('','popw','width=290,height=400,scrollbars=yes,menubar=no,resizable=yes')"
method="post">
<input type="submit" name="Tell" value=" Send This
Page To Your Friend! ">
<input type="hidden" name="pagetemplate"
value="<CFOUTPUT>#cgi.</CFOUTPUT>">
</form>

Invitation form code (pop-up window):

<cfform action="refer.cfm" method="POST">
<cfoutput><input name="pagetemplate" type="hidden"
value="#pagetemplate#"></cfoutput>
(note .. you could also pull the URL dynamically using
the CGI referrer variable)

Friends Email:
<CFINPUT TYPE="TEXT" NAME="remailone" SIZE="18"
value="" REQUIRED="Yes" MESSAGE="You must input an
email address to send to" MAXLENGTH="75"> 

Your Name:
<CFINPUT TYPE="TEXT" NAME="yourname" REQUIRED="Yes"
MESSAGE="You must input your name!" SIZE="18"
MAXLENGTH="67">  

Your Email:
<CFINPUT TYPE="TEXT" NAME="youremail" REQUIRED="Yes"
MESSAGE="You must input your email!" SIZE="18"
MAXLENGTH="67"> 

<INPUT TYPE="Submit" NAME="Refer" VALUE="Send!">
</cfform>


Mailing code:


<CFMAIL TO="#toemail#" FROM="#form.youremail#"
Subject="#form.yourname# invites you to #sitename#!">

#form.yourname# invites you to visit (your site)!  

http://www.yoursite.com/#templatename#

</CFMAIL>

For some visual examples, check out 
http://www.maxrefer.com -- it's a complete 
'tell-a-friend' web application written in
CF.

HTH

Mark

http://www.maxrefer.com
Tell-A-Friend on steriods!



--- Dasher <[EMAIL PROTECTED]> wrote:
> What's the best way to set up an
> "Email This Page To A Friend"
> using Cold Fusion?
> 
> I need to get input like "name_of_friend" and
> "your_name"
> and plug it in to the emailed page...
> 
> Thanks,
> Dasher
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to