Posted on March 3rd, 2008
7163 views
Here's a great script i made, it's a brilliant way to get friends to refer friends to your site.
Working example: http://hearajoke.uni.cc/tellafriend In this simple tutorial, i will explain to you how to make it: tellafriend.php <h1>Tell A Friend</h1> //Page title Then the process page! tafprocess.php [code=php]<h1>Tell A Friend <span>Email Report</span></h1> <?php $email1 = $_POST['email1']; $email2 = $_POST['email2']; $email3 = $_POST['email3']; $email4 = $_POST['email4']; $email5 = $_POST['email5']; ?> <?php $to = "$email1"; $subject = "Your Friend Has Invited You To yousite.com"; $body = 'You have been invited to yousite.com by your friend, Please visit YourSite at http://yousite.com (You may need to copy the address into your browser) Thank You Very Much We cannot wait to see you there.'; if (mail($to, $subject, $body)) { echo "$email1 - Sent<br />"; }else{ echo "Friend 1 - Failed<br />"; } ?> <?php $to = "$email2"; $subject = "Your Friend Has Invited You To yousite.com"; $body = 'You have been invited to yousite.com by your friend, Please visit YourSite at http://yousite.com (You may need to copy the address into your browser) Thank You Very Much We cannot wait to see you there.'; if (mail($to, $subject, $body)) { echo "$email2 - Sent<br />"; }else{ echo "Friend 2 - Failed<br />"; } ?> <?php $to = "$email3"; $subject = "Your Friend Has Invited You To yousite.com"; $body = 'You have been invited to yousite.com by your friend, Please visit YourSite at http://yousite.com (You may need to copy the address into your browser) Thank You Very Much We cannot wait to see you there.'; if (mail($to, $subject, $body)) { echo "$email3 - Sent<br />"; }else{ echo "Friend 3 - Failed<br />"; } ?> <?php $to = "$email4"; $subject = "Your Friend Has Invited You To yousite.com"; $body = 'You have been invited to yousite.com by your friend, Please visit YourSite at http://yousite.com (You may need to copy the address into your browser) Thank You Very Much We cannot wait to see you there.'; if (mail($to, $subject, $body)) { echo "$email4 - Sent<br />"; }else{ echo "Friend 4 - Failed<br />"; } ?> <?php $to = "$email5"; $subject = "Your Friend Has Invited You To yousite.com"; $body = 'You have been invited to yousite.com by your friend, Please visit YourSite at http://yousite.com (You may need to copy the address into your browser) Thank You Very Much We cannot wait to see you there.'; if (mail($to, $subject, $body)) { echo "$email5 - Sent<br />"; }else{ echo "Friend 5 - Failed<br />"; } ?>[/code] The script above sends the email to each person and reports back wether the email was valid and sent or if nothing was inputed and failed. Thank you for reading my tutorial. Sponsored By HearAJoke.uni.cc |