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)

Junior Member

5+ Year Member

joined:Aug 21, 2008
votes: 1

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 Sept 24, 2008 (gmt 0)


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

joined:Aug 10, 2004
votes: 43

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 Sept 24, 2008 (gmt 0)

Junior Member

5+ Year Member

joined:Aug 21, 2008
votes: 1

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 Sept 29, 2008 (gmt 0)

Junior Member

5+ Year Member

joined:Nov 3, 2007
votes: 0

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 Sept 29, 2008 (gmt 0)

Junior Member

5+ Year Member

joined:Sept 29, 2008
posts: 52
votes: 0

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'


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members