Time:
Scotland: Sat, 6:46 am
Rhode Island: Sat, 1:46 am
Florida: Sat, 1:46 am
New Mexico: Fri, 11:46 pm
California: Fri, 10:46 pm

Click here to visit Livelife365.com

Click here to visit nmdarts.com



Buy this Ad Space.

180px wide.

Please get in touch with KH@ if you are interested and make an offer.

Selanac Embroidery and Screen Printing

Embroidery
Screen Printing
Signs and Banners
Promotional Advertising

WEBSITE

Contact Paul Canales
TEl: USA 732-901-8417
CELL: USA 732-773-1339


Please click here for more information


For continued disscussion on this topic : coldfusion email to a freind.......


silverfox63
12-13-2001, 07:46 PM
Hi, has anybody seen decent email to a friend coldfusion script, could i pass the link to be sent as a query string.

thanks

silverfox

jonsteele
12-17-2001, 11:12 PM
I haven't been able to find one, but you could write your own!

All you need is the CFMAIL tag.

We can help you out if you get stuck.

Jon

silverfox63
12-18-2001, 07:43 PM
hi Jon, below is my first effort for the "email to friend script". I got an error from the <a href="#URL.article#>#URl.article#</a> in the <cfmail> tag. I realize there is not a proper server name there yet. The page is fed by passing the relevant artcile as a query string like so:

<a href="emailtoafriend.cfm?article=childrensgrowth.html">Email this article to a friend</a>

Any constructive criticism is appreciated.

thanks

silverfox

---------------------------------------------

<html>
<head>
<title>Untitled</title>
</head>

<body bgcolor="white">
<cfif IsDefined("URL.article")>
<cfoutput>
You would like a link to the article <a href=#URL.article#>#URL.article#</a> to be sent to a friend.
</cfoutput>
</cfif>

<cfif IsDefined("process")>
<cfmail to="#email#" server="servername" port="25" from="#youremail#" subject="Great website....">

#message#

Click below to read the article

<a href=##URL.article##>#URL.article#</a>

</cfmail>
<cfelse>
<blockquote>
<form name="aform" method="post" action="emailtoyou.cfm">
<input type="hidden" name="process" value="1">
<table border="0">
<tr>
<td>Your email:</td><td><input type="text" name="youremail" size="30" maxlength="30"></td>
</tr>
<tr>
<td>Recipients email:</td><td><input type="text" name="email" size="30" maxlength="30"></td>
</tr>
<tr>
<td valign="top">Additional message:</td><td><textarea cols="34" rows="6" wrap="virtual" name="message">Hi there, just thought you might be interested in this article from http://www.karekam.com
</textarea></td>
</tr>
<tr>
<td>&nbsp;</td><td><input type="submit" value="Send to a friend">&nbsp;<input type="reset" value="Reset the form"></td>
</tr>
</table>
</blockquote>
</cfif>
</body>
</html>

jonsteele
12-18-2001, 10:49 PM
Hi

Why the double # in the mail body?

Also, you should add type="HTML" in the cfmail tag if you're going to be using html tags in the email.

Besides that, I would change the logic a little. How about having the form on each article page, the code being included from one file for all articles. Then the form would go to a page which sends the email, and then redirects back to the article.

Something like this is an external file (which could easily be included on an article page):


<form action="sendtofriend.cfm" method="post" name="sendtofriendform">
<input type="hidden" name="article_name" value="<cfoutput>#article_name#</cfoutput>">
<input type="hidden" name="article_link" value="<cfoutput>#article_link#</cfoutput>">

your email <input name="from">
friend email <input name="to">
<textarea name="message_body">default message body</textarea>
<input type="submit" value="Send" name="submit">
</form>


Then on the sendtofriend.cfm page, you would send the mail and redirect back to the article.


<cfmail to="#to#" server="servername" port="25" from="#from#" subject="Great website....">

#message body#

article: #article_name#
link: #article_link#
</cfmail>
<cflocation url="#article_url#">


Do you see how that differs? you would include the first peice of code on every article page, set some variables which can be used beforehand (article_link, article_name, etc.). This would avoid a step for the user (having to click a url to see the form) and would avoid people sending fake urls by editing the url query string themselves ;).

Jon

silverfox63
12-19-2001, 06:17 PM
Hi Jon, yes I do see the logic of the above script and i will most likely implement your version, however, one small point I would like to clear up is this. Can I not include a URL variable inside a <cfmail> tag. Because the only error I got with the original script was that the URL.article variable was not recognized.

thanks

silverfox

jonsteele
12-19-2001, 11:45 PM
Could it be because of the double # around the variable name?