<?PHP
// Your site name for use in the email
$site_name="
www.your-domain.co.uk";// Your message for the email
$text="Hi there, take a look at this great site that I found $site_name";
// Title of email
$title="A message from your friend $sendername";
// Thank you page for users
$thankspage="
http://www.your-domain.co.uk/about.php";// START CODE, DO NOT CHANGE ANYTHING BELOW THIS LINE
// check email addresses
$x1 = ereg("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$",$senderemail);
if($x1==0)
# if no valid email address entered, display no email message
{
echo "<div align=center>You <b>must</b> specify a valid email address for yourself.
<a href=java script:history.back(-1)>Return to the form</a>.</div>";
exit;
}
if ($email<>"") {
$x2 = ereg("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$",$email);
if($x2==0)
# if no valid email address entered, display no email message
{
echo "<div align=center>!!ERROR!!<br>The first email address you entered is invalid.
<a href=java script:history.back(-1)>Return to the
form</a>.</div>";
}
}
if ($email2<>"")
{
$x3 = ereg("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$",$email2);
if($x3==0)
# if no valid email address entered, display no email message
{
echo "<div align=center>!!ERROR!!The second email address you entered is invalid.
<a href=java script:history.back(-1)>Return to the
form</a>.</div>";
}
}
if ($email3<>"")
{
$x4 = ereg("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$",$email3);
if($x4==0)
# if no valid email address entered, display no email message
{
echo "<div align=center>!!ERROR!!The third email address you entered
is invalid. <a href=java script:history.back(-1)>Return to the form</a>.</div>";
}
}
if (($x2!=0) || ($x3!=0) || ($x4!=0))
{
mail("$email", "$title", "$text", "From: \"$sendername\" $senderemail\n");
mail("$email2", "$title", "$text", "From: \"$sendername\" $senderemail\n");
mail("$email3", "$title", "$text", "From: \"$sendername\" $senderemail\n");
// return thank you page
header("Location: $thankspage");
}
?>