Error: Invalid referer. Email not sent.'; exit(); // Stop the script } // Set up email content $to = "admin@morangup.com.au"; $subject = "New message from The Morangup Website"; // Construct HTML email body $body = ''; $body .= '
'; // Apply border, padding, and centering $body .= 'Morangup Logo'; // Insert website logo $body .= '

New Message from Morangup.com.au

'; $body .= '

Name: ' . htmlspecialchars($name) . '

'; $body .= '

Email: ' . htmlspecialchars($email) . '

'; $body .= '

Message:

'; $body .= '

' . nl2br(htmlspecialchars($message)) . '

'; $body .= '

Time Sent: ' . $timestamp . '

'; $body .= '

IP Address: ' . $ip . '

'; $body .= '

Submitted from: ' . htmlspecialchars($referer) . '

'; $body .= '
'; $body .= ''; // Set email headers $headers = "From: admin@morangup.com.au\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=UTF-8\r\n"; // Send email if (mail($to, $subject, $body, $headers)) { echo '
SUCCESSFULLY SENT
'; echo '
You will be redirected to the homepage in 10 seconds...
'; // Add JavaScript for redirect echo ''; } else { echo '
Error sending email. Please try again later.
'; } } else { // Redirect back to the contact page if form is not submitted header("Location: contact.html"); exit(); } ?>