"recommend this site" code?

Miscellaneous Forums/General Discussion/"recommend this site" code?

Hiya, I want to put a "recommend this site" link on www.greyaliengames.com, so that visitors can enter the email address of their friend and it will auto-email them a link and bit of blurb.

Has anyone else done this? Do you have any example code (html or php) you would be kind enough to share. I'd really appreciate it - thanks :-)

not sure if this is what you need, but heres a tutorial on html email. Not sure if its any good, never looked at it before, but the site is generally helpful. http://pageresource.com/html/html_email.htm

Just a heads up: You should make sure that you're fairly rigid in what you allow to be sent through such a link, or before long some spammer will be abuse it to relay a paragraph of 'V!@9ra' spam with a grey alien games footer at the bottom...

(There's plenty of spammers actively looking for & abusing formmail scripts to relay threir junk)

bummer, OK thanks for the heads up.

How many friends? Up to 5 okay?

guess so well actually I was thinking of one friend but if the code has a capability to take a list then great. I was hoping to see working examples on other peoples site's to see what sort of wording they use on the web page and the email that get's forwarded plus of course some working code :-)

Look at PHP's mail(). If you don't want spam, don't offer a custom message.

I've just implemented it into IGB, go along to the cloverleaf site, register there (again) and see what happens. It's up to you where you ask for the friends emails!

@grey you can implement by pasting the following code into your webpage
<form method='post' action='http://www.indiegamebusiness.com/newsletter.subscribe.php'>
	<input type='hidden' name='newsletter_id' value='xx'>
	<input type='hidden' name='company_id' value='xx' >
        <input type='hidden' name='p_thru1' value='1'>
	<input type='hidden' name='refer' value='1'>
	Your Name
	<input type='text' name='email' size='40'><br>
	Friend 1
	<input type='text' name='f1' size='40'><br>
	Friend 2
	<input type='text' name='f2' size='40'><br>
	Friend 3
	<input type='text' name='f3' size='40'><br>
	Friend 4
	<input type='text' name='f4' size='40'><br>
	Friend 5
	<input type='text' name='f5' size='40'><br>
	<input type='submit' value='subscribe'>
</form>


You'll wanna check the "p_thru1" variable when it returns to your page, that way you can alter the confirmation message depending on the action.

This seems pretty cool! So I got you thinking after our chat hey?

ok, this is sorta along the correct lines, but I want to have a "Recommend this site to a friend" on the bottom of each page, when they click it, it needs to come up with the form like your code above makes. Is that possible without them having to actually subscribe to the newsletter first?

I see that it goes to a different confirmation page. How does this work, I don't understand how to check the p_thru1 variable, sorry :-)

About the email the friend receives I have some suggestions if you are willing to listen :-)

1) The top text is very small, kinda like a small print. I think most people will skip this and just see the confirmation line, especially as they are not expecting this email. This text should be at the bottom out of the way.
2)However still have the "Jake Birket has signed up for our newsletter and wanted to tell you about us." line in a black normal(not small) size font at the top, and also add on this after us "and our website http://www.website.com ".
3) Then change the next line to say "If you would like to subscribe to our free newsletter, please click here."
4) Then add some standard blurb about we will not use your email address for any other purpose and you can unsubscribe at any time etc. This is needed because the friend never saw the original newsletter page and thus never saw the reassuring text.
5) Only thing that can't be done without another IGB feature is actually ouput what the newsletter is about because at this point the friend doesn't really have a clue unless they visit the website first. The problem is, the newsletter content will vary from IGB client to client and thus it can't be a standard thing about games and free stuff etc.

What do you think to my suggestions? The sum of it is to really make the "friend" email more attractive and informative to make a sign up more likely, otherwise what's the point in sending it in the first place.

But this referrals thing is a cool idea for sure :-)

OK, I still need to fulfil my original idea somehow. That is simply having a link that the user clicks that lets them enter their name and one or more friends emails, and all it does is send them an email about the site with a link in it. The original user doesn't have to sign up to a newsletter first, it's just a real quick way to spread the word. Of course the email sent to the friends can mention the newsletter :-) Also if the form has 2 boxes for the user, one for their name and the other for their email, you can check for their email address in the newsletter list and if it's not there send them an invite too. This way you are not logging or collecting anyone's email addresses, merely sending them an invite, which is pretty polite. Groovy?

Helen was at a conference about science communication in Manchester at the start of this week and one of the big web hot shots was saying you must put a recommend this site link on your site as it really works.

Jake, please email me. I've really not got the time right now to read this and I'll only forget otherwise :)

1 friend?

<A HREF="mailto:?subject=look at this website&body=Hi, I found this website and thought you might like it http://www.angelfire.com/dc/html-webmaster/mailto.htm">tell a friend</A>

octo: thanks, yeah that would work, can a spammer automate it so that it can overwrite the message?

Tim: OK will do...

if spammer tries to automate from octo's code, they have to use thier own email address its just a link that outlook or other email program can read

cool thanks. I think I'll try that one out soon.

Spammers cannot abuse a mailto: the server is not providing any emailing services - only the hint that the client's browser should open an email program and start a new message (with some specified defaults.)

thats basically what i said but more technical.

however, it would be cool if it didn't open up the user's mail program because lots of people use online mail only, so the ability to auto-send an email would be great EVEN THOUGH it would be open to abuse of course. How could abuse in such as situation be prevented?

How could abuse in such as situation be prevented?


1) Have a PHP script that does the mailing, but only allow it to mail a static text thingey without customizable text

2) Have a PHP script that allows you to submit a message, but rather than sending it immediately have it queued somewhere for someone (=you) to confirm it being sent, to prevent abuse. Probably not too practical, though.

That said, personally I abolutely hate it when someone I know submitted my address through one of those 'forward to a friend' dealies. You always feel like they just handed over your address to some spambot. It just seems fishy why some random website would 'need' your email address... If anything it would make me suspicious of the site in question rather than 'greatful' for the 'exciting news'

Of course, your call. :-)

No.1 sounds the way to go. Actually I won't be retaining email addresses of sender or receiver, it's just to spread the word. I'll maybe say that somewhere too.

hmm, some recommend site seem to ask for the senders email address yet claim they are not storing them. What purpose is this for then, to fill out the "from" part of the email?

A friend may be able to email me some php code to sort this, we'll see.

It's on it's way.

I would ask for the names and e-mail, then send a msg to the person that clearly states what you want it to, and is really polite, as for the code to mail to them


Form html

<form action="mailer_sender.php" method="post">
Your Name<br>
<input type="text" name="sender_name"><br>
<br>
Your Friend's Name<br>
<input type="text" name="friend_name"><br>
<br>
E-mail addy of your friend<br>
<input type="text" name = "email"><br>
<br>
<input type="submit" value="submit">
</form>



mailer_sender.php (just the php)

<?
function checkOK($field)
{
if (eregi("\r",$field) || eregi("\n",$field)){
die("Invalid Input!");
}
}
$sender_name=$_POST['sender_name'];
checkOK($sender_name);
$friend_name=$_POST['friend_name'];
checkOK($friend_name);
$email=$_POST['email'];
checkOK($email);
$to=$email;
$message="Polite MSG that talks about your site and whatever else.";
if(mail($to,"$sender_name, thought you might like to know about this",$message,"From: you@...")) {
echo "We are telling them about it.";
} else {
echo "There was a problem sending the mail. Please check that you filled in the form correctly.";
}
?>



This SHOULD work, but might not if you don't have the right permissions when it comes to mail from your mail provider... Earthlink addresses through Comcast connections seem not to work at all, but you should have no problems if you host the files with the same host that sends you your mail. As in, you host the mailer at www.yoursite.com and send to you@....

dampens8n, great thanks, I'll try this out when my brain is working properly. I've got toothache right now ... ow!

Say I want to use MailTo but actaully want the body to have a hyperlink in it, how can I do this? e.g. this fails, it't doesn't seem to like the nesting:

<A HREF="mailto:?subject=look at this website&body=Hi, I found this website and thought that you might like it: <a href='http://www.greyaliengames.com/games.php'>grey</a>">Recommend this site</A>


thanks for any advice.

I'm surprised but it works here.

<A HREF="mailto:?subject=look at this website&amp;body=Hi, I found this website and thought that you might like it: <a href=&quot;http://www.greyaliengames.com/games.php&quot;>grey</a>">Recommend this site</A>



thanks, turns out I was just being a total dumbass, or rather Outlook Express was being crap. It showed the hyperlink but when I clicked it nothing was happening, that's because hyperlinks don't work in OE *until* you sent the bloody thing. How annoying and another hour or more wasted researching irrelevant crap on the internet.

lol