I was wondering if anyone else would be interested in a plugin that allows you to email a page/product info to a friend. This is like a referral thing. I am not a programmer, but I think it should not be too difficult to add a mail form into the Product details page. Problem is, if I did that, it would be a hack and not very portable across various QC versions. Anyone wanna try it?
function MM_validateForm() { //v4.0 var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments; for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]); if (val) { nm=val.name; if ((val=val.value)!="") { if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@'); if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n'; } else if (test!='R') { num = parseFloat(val); if (isNaN(val)) errors+='- '+nm+' must contain a number.\n'; if (test.indexOf('inRange') != -1) { p=test.indexOf(':'); min=test.substring(8,p); max=test.substring(p+1); if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n'; } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; } } if (errors) alert('The following error(s) occurred:\n'+errors); document.MM_returnValue = (errors == ''); } //--> </script> </head> <body> <?php if (!$FriendEmail) { ?> <br> <form name="form1" onsubmit="MM_validateForm('Name','','R','Email','','RisEmail','FriendName','','R','FriendEmail','','RisEm ail');return document.MM_returnValue" action="" method="POST"> <div align="center"> <table width="427" border="0" cellspacing="0" cellpadding="3"> <tr> <td width="69" align="right" valign="top"> </td> <td width="5"><font face="Verdana" size="2"> </font></td> <td width="113"><font face="Verdana" size="2">Name: </font> </td> <td width="216"> <font face="Verdana" size="2">E-mail:</font></td> </tr> <tr> <td align="right" valign="top"><font face="Verdana" size="2"><b>You:</b></font></td> <td> </td> <td> <font face="Verdana"> <input type="text" name="Name" size="15"><font size="2"> </font></font> </td> <td> <font face="Verdana"> <input type="text" name="Email" size="20"><font size="2"> </font></font> </td> </tr> <tr> <td align="right" valign="top"><font face="Verdana" size="2"><b>Friend:</b></font></td> <td> </td> <td> <font face="Verdana"> <input type="text" name="FriendName" size="15"><font size="2"> </font> </font> </td> <td> <font face="Verdana"> <input type="text" name="FriendEmail" size="20"><font size="2"> </font> </font> </td> </tr> <tr> <td align="right" valign="top"><font face="Verdana" size="2"><b>Message:</b></font></td> <td> </td> <td colspan="2"> <font face="Verdana"> <textarea name="emailtext" cols="38" rows="6" style="font-family: Trebuchet MS; font-size: 10pt"> I found this great website and I believe you would be interested in it. Here is the link to that page: <?php echo $string ?> </textarea><font size="2"> </font></font> </td> </tr> <tr> <td align="right"> </td> <td><font face="Verdana" size="2"> </font> </td> <td> <font face="Verdana"> <input type="submit" value="Send" name="Submit"><font size="2"> </font> </font> </td> <td> </td> </tr> </table> </div> </form> <?php } else { if ($FriendEmail) { mail( $FriendEmail, "Message from $Name", "$FriendName, \n\n".$emailtext ."\n\n$Name", "From: $Email");
}
echo "<center><br><br><font face=Verdana size=2>Thank you <font color=red>$Name</font>. The email has been sent to <font color=red>$FriendName</font>. <br><br><a href='javascript:window.close();'>Close this window</a></font><p> <font face=Verdana size=2>powered by: <a href=http://www.ergalia.com target=new>Tell A Friend</a></font></p>"; } ?> <p> </p> </body> </html>
panos
panos
2007-01-04 23:19
1) copy sendmail.php in the directory with all your .html or .php pages
to place a link just copy the following script between the <head> </head> tags of the pages
<script language="JavaScript"> function newWindow(mypage,myname,w,h,features) { if(screen.width){ var winl = (screen.width-w)/2; var wint = (screen.height-h)/2; }else{winl = 0;wint =0;} if (winl < 0) winl = 0; if (wint < 0) wint = 0; var settings = 'height=' + h + ','; settings += 'width=' + w + ','; settings += 'top=' + wint + ','; settings += 'left=' + winl + ','; settings += features; win = window.open(mypage,myname,settings); win.window.focus(); } </script>
2) To place a link just use the following html code:
<a href="javascript:newWindow('sendemail.php?'+document.location.href,'email',400,300,'')">Recommend this page to your friend</a>
If you want to send a link to your homepage: replace +document.location.href with http://www.site.com/
<a href="javascript:newWindow('sendemail.php?http://www.YOUR SITE.com/','email',400,300,'')">Recommend this page to your friend</a>
3) To change the message of the outgoing email just open sendemail.php in editor and change the msg in the box.
4) Any help email me at info@ergalia.com or use the contact us form.
panos
panos
2007-01-04 23:26
if you wont add images in ( Recommend this page to your friend )