$hostname = getenv("HOSTNAME");
if ($hostname == "susie") {
DEFINE ("MP_EMAIL_ADDRESS","hugh@localhost");
DEFINE ("CC_EMAIL_ADDRESS","hugh@localhost");
} else {
// can change this to Y if required BUT DO REMEMBER TO SET IT BACK to N
define("TESTMODE","N");
if (TESTMODE=="Y"){
DEFINE ("MP_EMAIL_ADDRESS","hugh@vcsnet.co.uk");
DEFINE ("CC_EMAIL_ADDRESS","monitor@vcsnet.co.uk");
} else {
DEFINE ("MP_EMAIL_ADDRESS","webresponse@managementpartners.net");
DEFINE ("CC_EMAIL_ADDRESS","monitor@vcsnet.co.uk");
}
}
// safe email format - just remove slashes but do not encode html chars
function sef($entry){
$entry= stripslashes($entry);
return $entry;
}
function emailValidateAddress($addr){
//testing fiddle
if (strrchr($addr,"@")=="@localhost"){
return true;
}
if (ereg ("^.+@.+\\..+$", $addr)) {
return true;
} else {
return false;
}
}
function myEmptyString($v) {
if ( ! isset($v) ) {
return(true);
}
if ( trim($v) == "" ) {
return(true);
} else {
return(false);
}
}
function js_alert($msg){
echo("\n \n");
}
function createEmail( $to, $from, $replyTo, $subject, $body)
{
// Prepare other email fields
if (myEmptyString($replyTo )){
$mailHeaders = "From: $from";
} else {
$mailHeaders = "From: $from\n\rReply-to: $replyTo";
}
// send mail
$rv = mail($to, $subject, $body, $mailHeaders);
return($rv);
}
function clientEmailtoMP($address, $subject, $body){
$rv= createEmail(MP_EMAIL_ADDRESS, $address, "", $subject, $body );
if (defined ("CC_EMAIL_ADDRESS") ){
if (!myEmptyString(CC_EMAIL_ADDRESS) ){
createEmail(CC_EMAIL_ADDRESS, "copy@vcsnet.co.uk", "", "COPY: ".$subject, $body );
}
}
return($rv);
}
if (!isset($action)){
$action="";
$name="";
$company="";
$companyemail="";
$email="";
$telephone="";
$ffaddress="";
$message="";
$netpart="";
$netintang="";
$netturkey="";
$optout="";
}
function ValidateContactForm(){
global $name, $company, $companyemail;
// Must enter name, organisation, e-mail address
// and if e-mail address entered must be of valid format
$emailOK = FALSE;
if (!myEmptyString($companyemail)) {
$emailOK = emailValidateAddress($companyemail);
}
$alert = "";
if ( myemptyString($name) ) {
$alert =" your name";
}
if ( myemptyString($company) ) {
if (!myEmptyString($alert)){
$alert .= " and";
}
$alert .=" your organisation";
}
if (!$emailOK) {
if (!myEmptyString($alert)){
$alert .= " and";
}
$alert .=" a valid e-mail address";
}
if (!myemptyString($alert) ) {
js_alert("Please enter" . $alert . ".");
return false;
} else {
return true;
}
}
$sentOK=0;
if ($action=="send"){
if ( ValidateContactForm()){
// email office about this enquiry
$body = "Enquiry from the Website";
$body.="\n\nContact Details:\n";
$body.="Name : ".sef($name)."\n";
$body.="Organisation : ".sef($company)."\n";
$body.="Organisation E-mail: ".sef($companyemail)."\n\n";
$body.="Preferred Contact Method(s):\n";
if (isset($email)) {
$body.="By E-mail to : ". sef($email)."\n";
} else {
$email=$companyemail;
}
if (isset($ffaddress)) {
$body.="By Post to:\n". sef($ffaddress)."\n";
}
if (isset($telephone)) {
$body.="By telephone on: ". sef($telephone)."\n";
}
$body.="\nInterests:\n";
if (isset($netpart)) {
$body.="Network on Partnering\n";
}
if (isset($netintang)) {
$body.="Network on Intangibles\n";
}
if (isset($netturkey)) {
$body.="Network on Turkey's EU Bid\n";
}
if (isset($message)) {
$body.="\n".
"Consultancy Interest Message:\n".sef($message)."\n";
}
if (isset($optout)) {
$body.="\nTHIS PERSON HAS OPTED OUT FROM MAILING LIST\n";
} else {
$body.="\nThis person has NOT opted out from the mailing list\n";
}
$body.="\n\n\n ** sent by VCS-DynaPager - Your Automated e-mail system **\n" ;
$body.="\n Contact from IP Address:".$GLOBALS["REMOTE_ADDR"]." via port ".$GLOBALS["REMOTE_PORT"]." at ".date("H:i j/n/Y")."\n";
clientEmailtoMP($email, "Enquiry from managementpartners.net", $body);
$sentOK=1;
}
}
?>
if ($sentOK==0){
?>
To
express interest in one of our managed networks or any area of
consultancy, please complete the details below and click on
SEND.
} else {
?>
Thank you, your enquiry has been
successfully sent and we will be in contact shortly.