if ($_POST['required']<>md5(gmmktime(0, 0, 0))) { header('Location: /mailerror?e=Form%20submission%20timed%20out'); // Suspected code hi-jack attempt exit; }; $enquirer_email = $_POST['entered_email']; $hotel_email = perch_content('email', true); $emm_email = 'rambutanhotelsr@micronetdev.com'; require_once($DOMAIN_ROOT.'~PHPMailer/class.phpmailer.php'); $subject = 'Website Contact Enquiry: '.$_POST['entered_email']; // First send email from enquirer to hotel $mail1 = new PHPMailer(); // defaults to using php "mail()" $body = '
'.PHP_EOL; $body = ''.PHP_EOL; $body.= '
'.PHP_EOL; $body.= ' '.PHP_EOL; $body.= ' '.PHP_EOL; $body.= ' '.PHP_EOL; $body.= ' '.PHP_EOL; $body.= '
'.PHP_EOL; $body.= ' '.PHP_EOL; $body.= ' '.PHP_EOL; $body.= ' '.PHP_EOL; $body.= ' '.PHP_EOL; $body.= ' '.PHP_EOL; $body.= '


 


 
'.PHP_EOL; $body.= 'The following enquiry has been received from a website visitor. You should respond within 24 hours.'.PHP_EOL.PHP_EOL; $body.= 'The details of the completed form enquiry are as follows:'.PHP_EOL.PHP_EOL; $body.= '

'.PHP_EOL; $body.= ' '.PHP_EOL; $body.= ' '.PHP_EOL; foreach ($_POST as $key=>$data) { if (substr($key, 0, 8)=='entered_') { $body.= ' '.PHP_EOL; }; }; $body.= '
Item NameData Entered
'.$key.''.$data.'

'.PHP_EOL; $body.= '
'.PHP_EOL; $body.= ' '.perch_content('company', true).'
Tel: '.perch_content('phone', true).' | Fax: '.perch_content('fax', true).' | '.perch_content('domain', true).'
'.PHP_EOL; $body.= '
'.PHP_EOL; $body.= '
'.PHP_EOL; $body.= '
'.PHP_EOL; $body.= ''.PHP_EOL; $body = eregi_replace("[\]",'',$body); $alttext = 'To view the full message, please use an HTML compatible email viewer'.PHP_EOL.PHP_EOL; $alttext.= 'The following enquiry has been received from a website visitor. You should respond within 24 hours.'.PHP_EOL.PHP_EOL; $alttext.= 'The details of the completed form enquiry are as follows:'.PHP_EOL.PHP_EOL; foreach ($_POST as $key=>$data) { if (substr($key, 0, 8)=='entered_') { $alttext.= $key.': '.$data.PHP_EOL; }; }; $mail1->SetFrom($enquirer_email, $_POST['entered_name']); // The enquirer $mail1->AddReplyTo($enquirer_email, $_POST['entered_name']); // The enquirer $mail1->AddAddress($hotel_email, 'Reservations, '.perch_content('company', true)); // The hotel $mail1->AddBCC($emm_email); // The e-Marketing Manager $mail1->Subject = $subject; $mail1->AltBody = $alttext; $mail1->MsgHTML($body); $sendresult1 = $mail1->Send(); // Second the acknowledgement email from hotel to enquirer $mail2= new PHPMailer(); // defaults to using php "mail()" $body = '
'.PHP_EOL; $body = ''.PHP_EOL; $body.= ''.PHP_EOL; $body.= ' '.PHP_EOL; $body.= ' '.PHP_EOL; $body.= ' '.PHP_EOL; $body.= ' '.PHP_EOL; $body.= '
'.PHP_EOL; $body.= ' '.PHP_EOL; $body.= ' '.PHP_EOL; $body.= ' '.PHP_EOL; $body.= ' '.PHP_EOL; $body.= ' '.PHP_EOL; $body.= ' '.PHP_EOL; $body.= '


 


 
'.PHP_EOL; $body.= '
'.PHP_EOL; $body.= 'Thank you for your enquiry.

'.PHP_EOL; $body.= 'Your enquiry has been sent to our staff. You should receive a response within 24 hours.

'.PHP_EOL.PHP_EOL; $body.= 'The details of the completed form enquiry are as follows:
'.PHP_EOL.PHP_EOL; $body.= '

'.PHP_EOL; $body.= ' '.PHP_EOL; $body.= ' '.PHP_EOL; foreach ($_POST as $key=>$data) { if (substr($key, 0, 8)=='entered_') { $body.= ' '.PHP_EOL; }; }; $body.= '
Item NameData Entered
'.substr($key, 8).''.$data.'

'.PHP_EOL; $body.= '
'.PHP_EOL; $body.= ' '.perch_content('company', true).'
Tel: '.perch_content('phone', true).' | Fax: '.perch_content('fax', true).' | '.perch_content('domain', true).'
'.PHP_EOL; $body.= '
'.PHP_EOL; $body.= '
'.PHP_EOL; $body.= '
'.PHP_EOL; $body.= ''.PHP_EOL; $body = eregi_replace("[\]",'',$body); $alttext = 'Thank you for your enquiry.'.PHP_EOL.PHP_EOL; $alttext.= 'To view the full message, please use an HTML compatible email viewer'.PHP_EOL.PHP_EOL; $alttext.= 'Your enquiry has been sent to our staff. You should receive a response within 24 hours.'.PHP_EOL.PHP_EOL; $alttext.= 'The details of the completed form enquiry are as follows:'.PHP_EOL.PHP_EOL; foreach ($_POST as $key=>$data) { if (substr($key, 0, 8)=='entered_') { $alttext.= substr($key, 8).': '.$data.PHP_EOL; }; }; $mail2->SetFrom($hotel_email, 'Reservations, '.perch_content('company', true)); // The hotel $mail2->AddReplyTo($hotel_email, 'Reservations, '.perch_content('company', true)); //The hotel $mail2->AddAddress($enquirer_email, $_POST['entered_name']); // The enquirer $mail2->Subject = $subject; $mail2->AltBody = $alttext; $mail2->MsgHTML($body); $sendresult2 = $mail2->Send(); if(!($sendresult1 and $sendresult2)) { header('Location: /mailerror?e='.$mail1->ErrorInfo.' / '.$mail2->ErrorInfo); // mail sending error exit; } else { header('Location: /thankyou'); // mail sending success exit; }; ?>