Jump to content

Recommended Posts

I have used a simple php form to send an email form and it all works fine. I setup an html auto responder in the email control panel through Heart Internet, that works fine too. The problem is that when an email is sent using the form (shows email entry as sender) there is no autoresponse. My php code is...

 

 

<?php error_reporting(7); if ($_GET['hdwtest']=='captchainstalled') { echo 'Captcha verification code installed.'; exit; } if (count($_POST) > 0 || count($_GET) > 4) { @session_start(); foreach ($_GET as $item => $value)@setcookie ('hdw_'.$item, (is_array($value)?implode(",",$value):str_replace("\'","'",$value)), 0, '/');foreach ($_POST as $item => $value)@setcookie ('hdw_'.$item, (is_array($value)?implode(",",$value):str_replace("\'","'",$value)), 0, '/');foreach ($_COOKIE as $item => $value)  if (substr($item,0,4) == 'hdw_' && $_GET[substr($item,4)] == '' && $_POST[substr($item,4)] == '')@setcookie ($item, '', 0, '/'); if ((empty($_POST['hdcaptcha']) || $_POST['hdcaptcha'] == '' || strtolower($_POST['hdcaptcha']) != strtolower($_SESSION['rand_code'])) && (empty($_GET['hdcaptcha']) || $_GET['hdcaptcha'] == '' || strtolower($_GET['hdcaptcha']) != strtolower($_SESSION['rand_code']))) {if ($_POST['hdwfail'] != '')header('Location: '.$_POST['hdwfail']);else header('Location: '.$_GET['hdwfail']);exit;} foreach ($_COOKIE as $item => $value) if (substr($item,0,4) == 'hdw_')@setcookie ($item, '', 0, '/'); } reset($_POST);reset($_GET); ?>
<?php error_reporting(7); if ($_GET['hdwtest']=='captchainstalled') { echo 'Captcha verification code installed.'; exit; } if (count($_POST) > 0 || count($_GET) > 4) { @session_start(); foreach ($_GET as $item => $value)@setcookie ('hdw_'.$item, (is_array($value)?implode(",",$value):str_replace("\'","'",$value)), 0, '/');foreach ($_POST as $item => $value)@setcookie ('hdw_'.$item, (is_array($value)?implode(",",$value):str_replace("\'","'",$value)), 0, '/');foreach ($_COOKIE as $item => $value)  if (substr($item,0,4) == 'hdw_' && $_GET[substr($item,4)] == '' && $_POST[substr($item,4)] == '')@setcookie ($item, '', 0, '/'); if ((empty($_POST['hdcaptcha']) || $_POST['hdcaptcha'] == '' || strtolower($_POST['hdcaptcha']) != strtolower($_SESSION['rand_code'])) && (empty($_GET['hdcaptcha']) || $_GET['hdcaptcha'] == '' || strtolower($_GET['hdcaptcha']) != strtolower($_SESSION['rand_code']))) {if ($_POST['hdwfail'] != '')header('Location: '.$_POST['hdwfail']);else header('Location: '.$_GET['hdwfail']);exit;} foreach ($_COOKIE as $item => $value) if (substr($item,0,4) == 'hdw_')@setcookie ($item, '', 0, '/'); } reset($_POST);reset($_GET); ?>
<?php
//--------------------------Set these paramaters--------------------------
 
// Subject of email sent to you.
$subject = 'Message From Living Style  Website'; 
 
// Your email address. This is where the form information will be sent. 
$emailadd = 'enquiries@deanrice.com'; 
 
// Where to redirect after form is processed. 
 
// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '0'; 
 
// --------------------------Do not edit below this line--------------------------
$text = "Results From Your Website Form:\n\n"; 
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$_POST['Email'].'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>
 
 
Any help would be greatly appreciated.
Link to comment
https://forums.phpfreaks.com/topic/275763-php-form-not-allowing-auto-responder/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.