Tell a Friend link to populate fields in email client

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
ninethousandfeet
Forum Contributor
Posts: 130
Joined: Tue Mar 10, 2009 4:56 pm

Tell a Friend link to populate fields in email client

Post by ninethousandfeet »

Hello.

I am trying to add a feature to my site that seems to be a common practice these days on the web. I would like to have a link that says Tell a Friend if the user wants to email someone about the page they are viewing.

I need help populating the body field in the mail client. I have it working to where the info appears in the body as it should, but I want to know if there is a way to add line breaks and also how I can make sure the link actually appears as a hypertext link versus just text.

here is what i have right now:

Code: Select all

 
<a href="mailto:?subject=<?php echo 'Thought of you when I read this';?>&body=Check out their profile when you get a chance and see if this post is something you want. http://www.mysite.com/profile.php?username=<?php echo $row_getPOSTER['username'];?>" title="tell a friend" class="boldFont">Tell a friend</a>
 
Additional problem if you know how to fix it... I need to make a RewriteRule for the link to go to someone else's profile. Rather than something so long as it appears above, I would like people to have the option to just type mysite.com/username ...

Thank you!
ggwarpig
Forum Newbie
Posts: 7
Joined: Wed Sep 09, 2009 12:47 pm

Re: Tell a Friend link to populate fields in email client

Post by ggwarpig »

1) I havn't seen a way to insert line breaks in prepop emails
2) 99% of email clients will convert that url into a link on the receiving end. If you put a link tag around the url, it will show up sometimes and look ugly.
3) I am working on a bunch of rewrite stuff right now with some luck. Try something like:

Code: Select all

RewriteRule ^(.*)$ /profile.php?username=$1 [NC,L]
Let me know if that works, we can troubleshoot it.
ninethousandfeet
Forum Contributor
Posts: 130
Joined: Tue Mar 10, 2009 4:56 pm

Re: Tell a Friend link to populate fields in email client

Post by ninethousandfeet »

Hi,

I just tried that out and it doesn't recognize that page and just gives me an error.

Any other suggestions? I'm looking around as well, so I'll let you know if I come across a solution.

Thanks for helping.
ggwarpig
Forum Newbie
Posts: 7
Joined: Wed Sep 09, 2009 12:47 pm

Re: Tell a Friend link to populate fields in email client

Post by ggwarpig »

did you have a trailing slash? try it without: mysite.com/username

I am trying to figure out how to handle trailing slashes over here.
ninethousandfeet
Forum Contributor
Posts: 130
Joined: Tue Mar 10, 2009 4:56 pm

Re: Tell a Friend link to populate fields in email client

Post by ninethousandfeet »

no luck with that option, same results.
Post Reply