I have implemented "Send to Friend" feature using eForm. The steps are:
1. implement
referer snippet:
<?php
return $_SERVER['HTTP_REFERER'];
?>
2.
create a page which will host "send to friend" form, for example a page with alias "share"
Please enter details about you and your friend
[!eForm? &formid=`shareForm` &tpl=`share-form` &report=`share-report` &thankyou=`share-thankyou` &from=`[email protected]` &sendirect=1 &subject=`[+yourName+] recommends you a page`!]
Note the
sendirect argument, we will come back to it later.
Now you have to define three chunks: share-form, share-report and share-thankyou.
3.
create a form share-form
[+validationmessage+]
<form class="askform" method="post" action="[~[*id*]~]">
<input type="hidden" name="formid" value="shareForm" />
<input type="hidden" name="referer" value="[[referer]]" eform="::0::"/>
<p><label accesskey="e" for="email">Friend's Email Address</label>
<input type="text" name="email" size="40" maxlength="60" eform="Friend's Email Address:email:1" /></p>
<p><label accesskey="n" for="yourName">Your Name</label>
<input type="text" name="yourName" maxlength="60" eform="Your Name::1:" /></p>
<p><label accesskey="e" for="youremail">Your Email Address</label>
<input type="text" name="youremail" size="40" maxlength="60" eform="Your Email Address:email:0" /></p>
<p><label accesskey="c" for="comments">Comments</label>
<textarea cols="40" rows="10" name="comments" eform="comments:html:1"></textarea></p>
<p><input class="submit" type="submit" name="submit" value="Share"></p>
</form>
It is important to have the friends email identified as
email, it will be used as recipient of the message by using the previously mentioned flag
sendirect=1.
4.
Create mail message body chunk named share-report
In the message you are going to use
as a link to the page the visitor was visiting just before he decided to share the page:
<p>Hi,</p>
<p>
Your friend [+yourName+] [+youremail+] would like you to see a page at YOUR_SITE_NAME web site. He notes:</p>
<p>[+comments+]</p>
<p>The link to the page is: <a href="[+referer+]">[+referer+]</a></p>
<p>We hope that you will find the link useful.</p>
<p><em>Note: This is automated email message. Please, do not reply to this email. </em></p>
<p>Best regards,</p>
5.
Create a thank you message chunk share-thankyou
6. Put a link to the "share" page in a page template
I think it is all. Enjoy.