homepage Welcome to WebmasterWorld Guest from 54.197.215.146
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / WebmasterWorld / Webmaster General
Forum Library, Charter, Moderators: phranque & physics

Webmaster General Forum

    
Setting up a "Tell a Friend About This Page' script
if your site isn't in php
DXL




msg:3407542
 6:52 am on Jul 29, 2007 (gmt 0)

I want to start adding a feature on individual site pages which allow someone to send an email to a friend saying something like "____ thought that you would like this page".

Where can I find or buy a script that will allow me to do this on standard .html pages, rather than php ones?

 

BeeDeeDubbleU




msg:3407550
 7:09 am on Jul 29, 2007 (gmt 0)

Try [google.com...]

thecoalman




msg:3407560
 7:27 am on Jul 29, 2007 (gmt 0)

The only way I'm aware of for sending e-mail from a HTML page is with "mailto:" which isn't very reliable because the user needs to have a configured default e-mail client.

To send it from the server it has to be processed by something like a php script.

Marshall




msg:3407569
 8:19 am on Jul 29, 2007 (gmt 0)

I forget where I got this, but it works well.

Marshall

<script type="text/javascript">

<!-- Begin
function isPPC() {
if (navigator.appVersion.indexOf("PPC")!= -1) return true;
else return false;
}
if(isPPC()) {
document.write('A HREF=\"mailto:\?subject\=Take a look at this page I found, ' + document.title + '?body=You can see this page at: ' + window.location + '\" OnMouseOver="status=\' \'; return true;" TITLE="Send your friends an e-mail about this page">Email this page to a friend<\/A>');
}
else { document.write('<A HREF=\"mailto:\?body\=Take a look at this page I found, ' + document.title + '. You can see this page at: ' + window.location + '\" OnMouseOver="status=\' \'; return true;" TITLE="Send your friends an e-mail about this page">Email this page to a friend<\/A>');
}
// End -->
</script>

DXL




msg:3407581
 8:51 am on Jul 29, 2007 (gmt 0)

Try [google.com...]

Not very helpful considering I Googled it beforehand and only found scripts related to php programs or sites that were willing to do it for me given they place my ads in the emails received.

Marshall, that's a useful script (tested it). The only downside is that it relies on someone's default email program, and not everyone uses Outlook. I guess I'm looking for something more along the lines of a program that will simply ask for the email of the user, email or name of the sender and then be sent via my server.

Here's also a thought: I use server side includes on some sites. Could I get away with doing a blank php-driven "tell a friend page" and simply reference it as a footer include on all my regular html pages (just as I use ads or footer links as includes)? Maybe that way the php form could work on an html page.

[edited by: DXL at 8:55 am (utc) on July 29, 2007]

vincevincevince




msg:3407583
 9:07 am on Jul 29, 2007 (gmt 0)

You do need PHP or similar but it can be done 'from' your HTML pages.

Here's an example:
<a href="#" onClick="javascript:window.open('tellafriend.php?title='+escape(document.title)+'&url='+escape(window.location), 'taf_dialogue', 'height=200,width=300', false);">Tell a friend</a>

This is the tellafriend.php script:
<?php
if ($_POST['toemail')
{
//do validation here as required
mail($_POST[to],"Recommended page","Your friend, $_POST[fromname], recommends $_GET[title], a page found at $_GET[url]","From: $_POST[fromname] <$_POST[fromemail]>");
print "<center>We have let your friend know</center>";
}
else
{
print "<form method=\"POST\">
<label for=\"fromname\">Your name: </label><input type=\"text\" name=\"fromname\"><br>
<label for=\"fromname\">Your email: </label><input type=\"text\" name=\"fromemail\"><br>
<label for=\"fromname\">Friend's email address: </label><input type=\"text\" name=\"to\"><br>
<input type=\"submit\"></form>";
}
?>

thecoalman




msg:3407589
 9:38 am on Jul 29, 2007 (gmt 0)

One thing to be aware of is you're opening yourself up becoming a spam relay. You're going to want to make it secure as possible if using PHP or any other server side processing.

I'm no php expert but the script posted above for example appears to be vulnerable under any circumstances becsue it doesn't check for header injections, even if you specified the "to:" field in the script. Using Cc a bot could send out a massive amount spam in one post:

[securephpwiki.com...]

Whatever the case you better do some heavy duty research on securing it and limiting its usage.

benevolent001




msg:3407595
 10:09 am on Jul 29, 2007 (gmt 0)

I have been using cgi tell a friend script and its really good , just google tell a friend script and you will get it

vincevincevince




msg:3407638
 11:49 am on Jul 29, 2007 (gmt 0)

I'm no php expert but the script posted above for example appears to be vulnerable under any circumstances

See the line '//do validation here as required'?

I deliberately didn't post validation methods as to do so would reveal those which I use, making it easy for my own forms to be hacked...

Anat




msg:3408297
 6:20 am on Jul 30, 2007 (gmt 0)

I'd be weary of any script that sends the mail through my site. I don't want to get into trouble and being accused of spam... and it could happen when the mail is coming from your domain name.

piatkow




msg:3408340
 8:59 am on Jul 30, 2007 (gmt 0)

There are hosted services that will do this as well, of course they do look a bit naff on your site.

My thought on these is that fake "tell a friend" messages used to be a major route for spam and viruses although I haven't noticed any recently. Anybody who is reasonably web savvy will have their filters set to zap them unopened.

BeeDeeDubbleU




msg:3408355
 9:24 am on Jul 30, 2007 (gmt 0)

Not very helpful considering I Googled it beforehand

Very sorry for not being helpful, perhaps I better stop trying?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / Webmaster General
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved