/** Contact Form **/ function TB_ContactForm($emailTo, $emailCC = FALSE, $sentHeading = 'Your message has been successfully submitted..', $sentMessage = 'We will get back to you asap.') { if (isset($_POST['contact_submit'])) { $error = ""; $fullname = makeSafe($_POST['fullname']); $email = makeSafe($_POST['email']); $phone = makeSafe($_POST['phone']); $message = makesafe($_POST['message']); $subject = "Enquiry from Canareef Resort Maldives"; $from_name = "Canareef"; $from_email = "*****@*****.**"; if (empty($fullname)) { $error['fullname'] = "Your Name"; } if (empty($email) || !isValidEmail($email)) { $error['email'] = "Your Email"; } if (empty($message)) { $error['message'] = "Your Message"; } if (!empty($_POST['antispam'])) { echo '<p>We don’t appreciate spam.</p>'; } elseif (!empty($error)) { TB_DisplayForm($error); } else { $content = __('Name') . ' : ' . $fullname . "\n" . __('Email') . ' : ' . $email . "\n" . __('Phone Number') . ' : ' . $phone . "\n" . __('Message') . " : \n" . $message . "\n\n"; $headers = 'From: =?UTF-8?B?' . base64_encode($fullname) . '?= <' . $email . '>' . "\r\n"; // $headers = 'From: =?UTF-8?B?'.base64_encode($from_name).'?= <'.$from_email.'>'."\r\n"; $emailBCC = ''; if ($emailCC) { $headers .= 'CC: ' . $emailCC . "\r\n"; } if ($emailBCC != '') { $headers .= 'BCC: ' . $emailBCC . "\r\n"; } $headers .= 'Reply-To: ' . $email . "\r\n"; $headers .= 'Content-type: text/plain; charset=UTF-8'; if (mail($emailTo, $subject, $content, $headers)) { echo '<a id="contact-status" name="status"></a>' . "\n"; echo '<p class="tbSuccess">' . __($sentHeading) . ' ' . __($sentMessage) . '</p>' . "\n"; $fullname = ""; $email = ""; $phone = ""; $message = ""; } else { $error['sendemail'] = "Email could not be sent."; } TB_DisplayForm($error); } } else { TB_DisplayForm(); } }
/** Contact Form **/ function TB_ContactForm($emailTo, $emailCC = FALSE, $sentHeading = 'Your message was sent successfully.', $sentMessage = 'We will get back to you soon.') { if (isset($_POST['contact_submit'])) { $error = ""; $fullname = makeSafe($_POST['fullname']); $email = makeSafe($_POST['email']); $phone = makeSafe($_POST['phone']); $message = makesafe($_POST['message']); $subject = "Enquiry from Estadia by Hatten"; if (empty($fullname)) { $error['fullname'] = "Your name"; } if (empty($email) || !isValidEmail($email)) { $error['email'] = "Email Address"; } if (empty($message)) { $error['message'] = "General Enquiry"; } if (!empty($_POST['antispam'])) { echo '<p>We don’t appreciate spam.</p>'; } elseif (!empty($error)) { TB_DisplayForm($error); } else { $content = __('Name') . ' : ' . $fullname . "\n\n" . __('Email Address') . ' : ' . $email . "\n\n" . __('Contact No.') . ' : ' . $phone . "\n\n" . __('General Enquiry') . " : \n\n" . $message . "\n\n"; $headers = 'From: =?UTF-8?B?' . base64_encode($fullname) . '?= <' . $email . '>' . "\r\n"; $emailBCC = ''; if ($emailCC) { $headers .= 'CC: ' . $emailCC . "\r\n"; } if ($emailBCC != '') { $headers .= 'BCC: ' . $emailBCC . "\r\n"; } $headers .= 'Reply-To: ' . $email . "\r\n"; $headers .= 'Content-type: text/plain; charset=UTF-8'; if (mail($emailTo, $subject, $content, $headers)) { echo '<a id="contact-status" name="status"></a>' . "\n"; echo '<p class="tbSuccess">' . __($sentHeading) . ' ' . __($sentMessage) . '</p>' . "\n"; } else { $error['sendemail'] = "Email could not be sent."; } TB_DisplayForm($error); } } else { TB_DisplayForm(); } }