Email This Page to a Friend


I recommend the following Web page:

"; $after = "

I found it on NUI Galway's Web site.

Regards,
"; if (empty($_POST['to'])) { ?> Please fill in the blanks, below, to email a link to '' to your friend.

Send Email To:
Subject: - NUI Galway


       ()

   

"; $continue = false; } else { $pattern = "^[\w\-\.]+@[a-z0-9]+[\-]?[a-z0-9]+( (\.(com|net|org|edu|int|mil|gov|info|co|name))| (\.(com|net|org|edu|int|mil|gov|info|co|name)\.[a-z]{2})| (\.[a-z]{2}))$"; $pattern = "/^[\w\-\.]+@[a-z0-9\-]+\.([a-z]{1,4}|[a-z]{1,4}\.[a-z]{2})/"; if (!preg_match($pattern, $to)) { echo "'$to' does not appear to be a valid email address.

"; $continue = false; } } //validate sender $from = validate($_POST['sender'], POLITE); if (empty($from)) { echo "No sender's name was provided.

"; $continue = false; } else { if (strlen($from) > 30) { echo "The sender's name is too long. Please limit this to under 30 characters.

"; $continue = false; } } //validate curpage to prevent abuse by spammers - page MUST exist on www.nuigalway.ie for mail to be sent //if (!file_exists(str_replace("http://www.nuigalway.ie/", "/www/", $curpage))) { // The path '/www/www.nuigalway.ie/htdocs' exists on sitemanager.nuigalway.ie AND the web cluster $filename = str_replace("preview.nuigalway.ie", "www.nuigalway.ie", validate($_POST['url'])); $filename = str_replace(":81", "", $filename); $filename = str_replace(":82", "", $filename); $filename = preg_replace("/www.\./i", "www.", $filename); $filename = str_replace("http://www.nuigalway.ie/", "/www/www.nuigalway.ie/htdocs/", $filename); $filename = str_replace("https://www.nuigalway.ie/", "/www/www.nuigalway.ie/htdocs/", $filename); if (!file_exists($filename)) { echo "Error: cannot find the page '" . $_POST['url'] . "' on NUI Galway's Web site.

"; $continue = false; $retry = false; } $_SESSION['emailTo'] = $to; $_SESSION['name'] = validate($_POST['sender'], POLITE); //$body = "Hi,\r\nI found this page on NUIGalway.ie, and thought you might be interested in it.\r\n\r\n " . keepItClean($_POST['title']) . " <" . keepItClean($_POST['url']) . ">\r\n\r\nRegards,\r\n" . keepItClean($_POST['sender']); $body = str_replace("
", "\r\n", $before) . " " . $pgtitle . " (" . validate($_POST['url'], POLITE) . ")" . str_replace("
", "\r\n", $after) . validate($_POST['sender'], POLITE); $subject = $pgtitle . " - NUI Galway"; if ($continue) { $success = mail($to, $subject, $body, "From: webserver@nuigalway.ie\nReply-To: webserver@nuigalway.ie"); if ($success) { echo "The email to $to was sent successfully."; } else { echo "Sorry! Due to technical problems, the email could not be sent. Please try again later."; } } else { echo "Sorry! The email could not be sent."; if ($retry) { echo "Try again."; } } echo "

Return to '" . $pgtitle . "'

"; } ?>