Hi,
I’m currently trying to personalize a theme I downloaded. It has a contact form with a php script for sending emails.
The emails don’t come through. I have used a basic php script to see whether my server was allowing php sendmail and that seems to work so there must be something wrong with the script itself although I don’t see it.
Any ideas?
Many thanks!
[php]<?php
if($_REQUEST[‘first_name’] == ‘’ || $_REQUEST[‘contact_email’] == ‘’ || $_REQUEST[‘message’] == ‘’):
return “error”;
endif;
if (filter_var($_REQUEST[‘contact_email’], FILTER_VALIDATE_EMAIL)):
$subject = ‘Contact from Webpage’; // Subject of your email
// Receiver email address
$to = ‘[email protected]’; //Change the email address by yours
// prepare header
$header = ‘From: ‘. $_REQUEST[‘first_name’] . " " .$_REQUEST[‘last_name’] . ’ <’. $_REQUEST[‘contact_email’] .’>’. “\r\n”;
$header .= ‘Reply-To: ‘. $_REQUEST[‘first_name’] . " " .$_REQUEST[‘last_name’] . ’ <’. $_REQUEST[‘contact_email’] .’>’. “\r\n”;
// $header .= 'Cc: ’ . ‘[email protected]’ . “\r\n”;
// $header .= 'Bcc: ’ . ‘[email protected]’ . “\r\n”;
$message .= 'Name: ’ . $_REQUEST[‘first_name’] . " " .$_REQUEST[‘last_name’] . “\n”;
$message .= 'Email: ’ . $_REQUEST[‘contact_email’] . “\n”;
$message .= 'Subject: ’ . $_REQUEST[‘contact_subject’] . “\n”;
$message .= 'Message: '. $_REQUEST[‘message’];
// Send contact information
mail($to, $subject, $message, $header);
echo ‘sent’;
else:
return “error”;
endif;
?>[/php]