| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- // Email address verification
- function isEmail($email) {
- return filter_var($email, FILTER_VALIDATE_EMAIL);
- }
- if($_POST) {
- // Enter the email where you want to receive the message
- $emailTo = 'madame.d.jour@gmail.com';
- $clientEmail = addslashes(trim($_POST['email']));
- $subject = addslashes(trim($_POST['subject']));
- $message = addslashes(trim($_POST['message']));
-
- $array = array('emailMessage' => '', 'subjectMessage' => '', 'messageMessage' => '');
- if(!isEmail($clientEmail)) {
- $array['emailMessage'] = 'Invalid email!';
- }
- if($subject == '') {
- $array['subjectMessage'] = 'Empty subject!';
- }
- if($message == '') {
- $array['messageMessage'] = 'Empty message!';
- }
- if(isEmail($clientEmail) && $subject != '' && $message != '') {
- // Send email
- $headers = "From: " . $clientEmail . " <" . $clientEmail . ">" . "\r\n" . "Reply-To: " . $clientEmail;
- mail($emailTo, $subject . " (bootstrap contact form)", $message, $headers);
- }
- // The echo command just outputs text. So all this line is doing is displaying whatever is in the
- // array variable on the page.
- //echo json_encode($array);
- // This line basically uses javascript to throw up an alert confirming success & then redirects the user to
- // the main page of the site once they confirm the alert. You may need to change the URL if you move the files
- // out of the revamp folder (just remove the "revamp" from the URL.
- echo '<script type="text/javascript">alert("Thanks for contacting me."); window.location.href="LINK"; </script>';
- }
- ?>
|