email to a friend link?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dirksmith
Forum Newbie
Posts: 11
Joined: Fri Oct 07, 2005 4:19 pm

email to a friend link?

Post by dirksmith »

hi

does anyone know how to create an 'email this page to a friend' link?

how is this done?

Many thanx

dirk
User avatar
php3ch0
Forum Contributor
Posts: 212
Joined: Sun Nov 13, 2005 7:35 am
Location: Folkestone, Kent, UK

Post by php3ch0 »

Try

Code: Select all

<a href="mailto:someone@somewhere.com
         ?subject=Check out this cool website
         &body=Look at this cool website http://www.gohere.com.">
         Email this page to a friend</a>
dirksmith
Forum Newbie
Posts: 11
Joined: Fri Oct 07, 2005 4:19 pm

thank u

Post by dirksmith »

thanx very much for that - cool simple solution!
User avatar
php3ch0
Forum Contributor
Posts: 212
Joined: Sun Nov 13, 2005 7:35 am
Location: Folkestone, Kent, UK

Post by php3ch0 »

Thanks I try my best!
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

The problem with that is it's nonstandard: not all email clients will allow ?subject=...
dirksmith
Forum Newbie
Posts: 11
Joined: Fri Oct 07, 2005 4:19 pm

email to a friend link?

Post by dirksmith »

yeah - just found that out - the link arrives as a dat file with which needs to be downloaded.

any ideas on a Javascript method of doing this?
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Probably can't be done. What you'll have to do is have the server send the email itself. But there are security implications, so make sure you ask before you try banging something out with mail(). I suggest using PHPMailer.
dirksmith
Forum Newbie
Posts: 11
Joined: Fri Oct 07, 2005 4:19 pm

js solution

Post by dirksmith »

just found javascript solution which is working fine - less involved than the php route:

http://javascript.internet.com/buttons/e-mail-link.html
Post Reply