tags:

views:

45

answers:

2

Is there a good tutorial on how to code a good email to a friend script using PHP. I assume I will need to use the PHP mail function.

A recommend to a friend script where a user can email a specific web page to a friend.

+1  A: 

Are you asking for best practices? Some off the top of my head are:

  • use a captcha to prevent spam

  • only allow a user to get a fixed number of messages a day (keep a DB of sent messages)

  • allow recipients to opt out (keep a db of opted out email addresses)

  • do some reg ex email validation

Evan
A: 

I would recommend the PHPMailer which will make it very easy to send mails (and set headers). They also have some easy tutorials. For the "send a friend" function itself I would use a form inside some kind of lightbox. I have also coded such a function with PHPMailer using thickbox.

EDIT: If you don't want to code it yourself take a look at Addthis. They offer hundreds of bookmarking option and also a "send a friend" function where you can even set up your own email template. You can customize the bookmarks and you can even reduce the funcionality to "email only". Just take a look at their functions in the API.

Kau-Boy