Welcome to WebmasterWorld Guest from 54.167.85.221

Forum Moderators: phranque

Message Too Old, No Replies

Setting up a "Tell a Friend About This Page' script

if your site isn't in php

     

DXL

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

WebmasterWorld Senior Member 10+ Year Member



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

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

WebmasterWorld Senior Member beedeedubbleu is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Try [google.com...]

thecoalman

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

WebmasterWorld Senior Member 10+ Year Member



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

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

WebmasterWorld Senior Member 10+ Year Member



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

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

WebmasterWorld Senior Member 10+ Year Member



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

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

WebmasterWorld Senior Member vincevincevince is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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

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

WebmasterWorld Senior Member 10+ Year Member



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

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

WebmasterWorld Senior Member 10+ Year Member



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

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

WebmasterWorld Senior Member vincevincevince is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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

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

10+ Year Member



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

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

WebmasterWorld Senior Member piatkow is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



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

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

WebmasterWorld Senior Member beedeedubbleu is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Not very helpful considering I Googled it beforehand

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

 

Featured Threads

Hot Threads This Week

Hot Threads This Month