Link to home
Start Free TrialLog in
Avatar of samiam41
samiam41Flag for United States of America

asked on

Allow customer to email link to webpage to a friend

Hi Experts.  I have seen this done on other sites but not sure how to integrate it into my website.  I have a section which allows customers to get a referral bonus if someone does business with us and tells us who sent them.  What I would like to do next is allow person A to visit my site, send person B the link to our "Referral" page right from our site and I get a copy of this email.  Any ideas?

Thanks Experts.

Like this example ->  http://www.nei.nih.gov/sendtoafriend.asp
Avatar of alien109
alien109
Flag of United States of America image

This is a somewhat complicated process, but if I were to implement something like this, I'd probably do something as follows:

User A clicks a "recommend this" link
User A fills out a form and enters User B's email, etc.
The form also contains info regarding what page they are recommending (in a hidden field, maybe)
User A submits the form and a database stores User A's user ID, the page ID. This row in the database is given a unique record ID which can be user to look up the user and the page info for the referral.
Server creates an email to User B (and yourself) which contains the link to the page, the unique id for the referral generated in the previous step. Something like http://www.somewhere.com/referral?refId=2323.
The link which User B clicks goes to a referral page, which looks up, based on the unique ID which is passed via querystring, what page they are going to, and what user recommended it.
Database then records that User B has followed that link, and credits User A with the referral. It then redirects them to the correct page.
well, you can't do this onlu with HTML, you have to use one of the scripting languages e.g in PHP. You just create forms with fields you want to, and sending e-mail using php functions, or one of the many classes you can find in internet.
Manu tutorials you will find in web, just check it: http://www.google.pl/search?q=sending+email+php
Avatar of samiam41

ASKER

Thanks for the quick responses!

Perhaps it would be easier if I did a slight variation from my original post.  After submitting my question, I did some more research and found that I am looking for "send link to friend".  I can do without capturing who person A is sending the email to which would eliminate the need for a database.

So perhaps I can pre-populate the subject and message fields and just have them enter in their email address as well as their friends.  Would that be easier?  I'm still learning to swim in the html/web programming field.

Thanks guys.
It will be easier if you don't have to send email link with referrals. Without it, the only thing you have to do is implement sending e-mail, without concerns about databases :).
Using static texts you don't have to worry about one more thing. Possibility of using your form as bot nest ;)
If you simply want to send an email, then you can just use built in mail functions. That's the easy part :) But, if you want to record the transaction and be able record the action of User B, so that User A gets a bonus if User B clicks the link, then your best bet is to use a database to record this info.
So if I wanted something like this:

Your name <  >
Your email address <  >
Subject <generic text(prepopulated)>
Description <generic text (prepopulated)>
Their email address <  >
Captcha
Submit

No capturing data.  Just rely on person B to tell us who referred them.  How would I write/program that with html?  Thanks for sticking with this.
You can't do this in HTML alone. You'll need to use a server side scripting language such as PHP, ASP, JSP, etc. I don't know where and on what your site is hosted, so I can't tell you which one to choose.
Found this on their site:

You can post a variety of files to your website.  For security reasons, we exclude only the following file types:

 .asa, .asp, .asptemp, .bat, .bok, .cdx, .cer, .cgi, .cmd, .com, .dll, .exe, .ffhtml, .htr, .idc, .jsp, .pl, .shtm, .shtml, .stm.

Avatar of Michel Plungjan
<form action="" onSubmit="this.action='mailto:'+this.email.value+'?subject=Please%20visit%20'+escape(location.href)+'&body='+escape(this.message.value)" enctype="text/plain">
.
.
.


Avatar of s8web
s8web

http://www.tamingthebeast.net/articles5/tell-a-friend-script-2.htm

I have used this script before. You will need to tweak if you want it to validate.
thanks for the additional suggestions.

@mplungjan, hey mate!  where would i enter that script?  i know, not the best question but i am not sure how to use that script.  it's not like css.  : )

@s8web, i checked the page but not sure the command i would use.  i am about as novice as you can be with this web stuff except when it comes to css which i have gotten much better with.
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
the php code in the link posted, can be used to spam people from your server. I do not see any control of from where the form is filled
Alright experts, I apologize for not getting back to this question sooner.  Dang that good summer weather!  : )

Ok, I have the code and all ready to test it only to find my host (Homestead) has their own flavor that they use and won't allow php to run.  Soooooooo, I have to use their solution since I suck so bad at websites and can't change hosts.

I am closing out the question and awarding points based on what I had tested.  Thanks as always for your time and help with this.
Thanks as always mate.  Another great solution that I will keep until I can one day implement.  Take care!

Regards,
Aaron