Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

How Do You Provide Visitors the Option to Share/E-mail Your Content?



5:55 am on Sep 24, 2008 (gmt 0)

5+ Year Member

Next to the content on many web sites it is now commonplace to find options to share the content on bookmark sites or e-mail the content to friends. For example, such options occur beneath YouTube videos. I want to do the same on my web site. The problem is, I haven't the slightest clue as to how it's done.

Can someone please give me a brief overview of how to do it, just to kickstart my learning?


6:52 am on Sep 24, 2008 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

in my experience these links typically send a form email along the lines of "a friend of yours thought you might be interested in browsing http://www.example.com/some-page-of-awesome-content".


6:22 pm on Sep 24, 2008 (gmt 0)

5+ Year Member

Thanks for the response, Phranque!

I understand that. What I meant was, what are the ways in which such a thing can be done?

For example, are there scripts which let you do it?

Here's what I want . . .

1) A visitor clicks the "E-mail" button
2) An e-mail form pops up, pre-populated with the content
3) All the visitor has to do is enter the person's e-mail, before clicking "Send"

Or . . .

1) A visitor clicks the "Share" link
2) A box appears with the logos of all the popular bookmarking sites
3) All the visitor has to do is choose a site, which is then pre-populated with the content


6:32 pm on Sep 29, 2008 (gmt 0)

5+ Year Member

You might want to use the mail() function [ca3.php.net] to do this.

What you can do is use some good Javascript code to make the user experience more... enjoyable:

1. Create a link that when clicked will popup a new window. Something like <a href="#" onClick="openWindow()">Send To A Friend</a>. Use the function "window.open(url,'name','height=200,width=150');" (with your own parameters) in your openWindow() function to open the window.
2. That popup window will have a form. Use PHP to process the form if the form has been submitted. When submitted, process the form and use the PHP function mail() to send a message containing the link to your article to the email specified in the form.

Good luck. You shouldn't have problems doing this. It is pretty straight forward.


11:04 pm on Sep 29, 2008 (gmt 0)

5+ Year Member

Hi Tehuti -

As for bookmarking, I recall that Digg had a few methods of adding a link on your site that would add the link to Digg. I believe one was a Digg button, but there was a URL you could copy to use a custom version of the button where you could add your own image or link.

As for mailing, I personally when possible use a free library called 'Swift Mailer'. It's free, fully featured and a lot quicker than the mail() function.

Be warned, it doesnt work on all hosts like GoDaddy for example, but the mail() function isn't always enabled either(Some hosts disable the use of it because it's very slow)

Swift Mailer makes it much easier to send html email, and large batches of email if need be. I suggest you Google "PHP swift mailer'


Featured Threads

Hot Threads This Week

Hot Threads This Month