tags:

views:

29

answers:

1

I was wondering is there a good tutorial on how to build a good recommend to a friend PHP script?

A: 

You can build the form anyway you like it and use the PHP mail function to send an email. Usually, such forms ask for the sender's and receiver's names and email addresses, along with a message to send. Once you get these, you can do something like this:

$headers = "From: $from_name <$from_email>";
mail($to_email, "$from_name has recommended <your site name>", $message, $headers);
casablanca
Are you sure you want to do that without sanitizing $from_name, $from_email, etc? You could be in for a surprise when they are using your form to spam email people.
Coltin
Of course, this is just an example. But even otherwise, I'm not sure that one can do much to check the validity of email addresses.
casablanca