View Full Version : e-mail a friend
comicw
09-21-2002, 12:35 PM
Hi,
I'm in need of a script by which visitors can e-mail their friends the address of our home page.
It should be something like this:
- it has to contain a fixed subject message
- the visitor should fill in his own e-mail and his friend's e-mail address
- when the visitor clicks on the 'send' button, the information containing the 2 e-mail addresses should also be sent to our email address.
I've been looking for this, but I can't find it. Can anyone over here help me out?
Sure can, take a look here
www.huntingground.freeserve.co.uk/webplus/email.htm
let me know if you have any further enquiries
comicw
09-21-2002, 03:06 PM
well, it's not soem kind of cut & paste script and since I don't know much about javascript, I don't know how to "fix" one of the examples (on the link you listed) into the shape I want to have it (as described above).
Have a play with this, see if we're on the right track:
<SCRIPT>
function Mailit(form) {
mailme="comicw@here.co.uk"
document.location.href=("mailto:" + form.address.value + "?cc="+ form.address2.value+";"+mailme+"&subject=A web page to see&body=I found this web page at " + document.location.href + ", which I thought you might like to see.")
return false
}
</SCRIPT>
<FORM name="Recom" onsubmit="return Mailit(Recom)">
<TABLE>
<TR><TD>Recommend this Web page to a friend</TD></TR>
<TR><TD><INPUT type="text" name="address" size="35" value="Friends Email Address"><BR>
<INPUT type="text" name="address2" size="35" value="Senders Address"><BR>
<INPUT type="button" name="Button" onclick="Mailit(this.form)" value="Send"></TD></TR>
</TABLE>
</FORM>
comicw
09-21-2002, 08:22 PM
Hi,
I've made this of your form, but when I want to preview it in my browser (IE) it says that there are problems with the script (like syntax-error). Can you fix this?
Here's the script:
<SCRIPT> <BR>function Mailit(form) { <BR>mailme="info@beleggingsvisie.be"
<BR>document.location.href=("mailto:" + form.address.value + "?cc="+
form.address2.value+";"+mailme+"&subject=Beleggingsvisie&body=Bekijk eens deze website: www.beleggingsvisie.be") <BR>return false <BR>} <BR></SCRIPT>
<FORM name="Recom" onsubmit="return Mailit(Recom)"> <TABLE width="451" height="1">
<td width="433" colspan="2" height="40">
<p align="center"><font face="Tahoma" color="#003399" size="2"><b><u>Tell a
friend<br>
<br>
</u></b></font>
<tr>
<td width="255" height="25"><font size="2" face="Tahoma">Het e-mailadres van
je vriend:</font>
<td width="255" height="25"><INPUT type="text"
name="address" size="35" value="">
</tr>
<tr>
<td width="255" height="25"><font size="2" face="Tahoma">Jou e-mailadres:</font>
<td width="255" height="25"><INPUT type="text"
name="address" size="35" value="">
</tr>
<tr>
<TD width="441" colspan="2" height="27" align="center"><br>
<INPUT type="button" name="button"
onclick="Mailit(this.form)" value="Verzenden"> <INPUT type="reset" name="Button1"
onclick="Mailit(this.form)" value="Wissen"></TD>
</tr>
</TABLE></FORM><BR>
Hi Comicw.
Below is the amend script, there were HTML tags in the script
For future reference, you do not include HTML tags in scripts, (unless you are using document.write etc)
See how it goes, I tested it out and it worked fine.
With this configuration the sender will get an email as well as the friend and yourself.
The senders address could be included in the body
<SCRIPT>function Mailit(form) {
mailme="info@beleggingsvisie.be"
document.location.href=("mailto:" + form.address.value + "?cc="+form.address2.value+";"+mailme+"&subject=Beleggingsvisie&body=Bekijk eens deze website: www.beleggingsvisie.be")
return false}</SCRIPT>
<FORM name="Recom" onsubmit="return Mailit(Recom)">
<TABLE width="451" height="1">
<tr>
<td width="433" colspan="2" height="40">
<p align="center"><font face="Tahoma" color="#003399" size="2"><b><u>Tell a friend<br><br></u></b></font>
</td>
<tr>
<td width="255" height="25"><font size="2" face="Tahoma">Het e-mailadres van je vriend:</font></td>
<td width="255" height="25"><INPUT type="text" name="address" size="35" value=""></td>
</tr>
<tr>
<td width="255" height="25"><font size="2" face="Tahoma">Jou e-mailadres:</font></td>
<td width="255" height="25"><INPUT type="text" name="address2" size="35" value=""></td>
</tr>
<tr>
<TD width="441" colspan="2" height="27" align="center">
<INPUT type="button" name="button" onclick="Mailit(this.form)" value="Verzenden">
<INPUT type="reset" name="Button1" value="Wissen"></TD>
</tr>
</TABLE></FORM><BR>
comicw
09-22-2002, 11:01 AM
I tried it, but I still get an error, but I don't see the problem in the script.
As far as I can tell, this is an exact copy of your script:
<SCRIPT>function Mailit(form) {
mailme="info@beleggingsvisie.be"
document.location.href=("mailto:" + form.address.value +
"?cc="+form.address2.value+";"+mailme+"&subject=Beleggingsvisie&body=Bekijk
eens deze website: www.beleggingsvisie.be")
return false}</SCRIPT>
scroots
09-22-2002, 11:09 AM
comicw is your script in you HTML code before your forms? if it is not it needs to be. As computers read code line by line and do not miss bits out and skip to the next bit.
scroots
I think it is the way this post renders its text.
If you take a look at the script you posted above you will see <BR> tags in the script.
These are not there in mine.
I have attached a zip, download it and open the file within.
comicw
09-22-2002, 03:03 PM
Thanks Mr J.
It doesn't give any problems now!
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.