Jump to content

reply to header


buddhapi

Recommended Posts

Can someone assist with this, the form works, but the end user cannot simply click on reply, they have to copy/paste. I think it is just a header issue, but i'm not sure and the person who wrote this script is no longer availalble...any help would be much appreciated!

 

 

<?php
if ($_POST['post'] != '')
{
$to = 'fetch@domain.com';
$subject = 'Appointment Request';
$message = "A user on the website has submitted an appointment request. Find their details below.\n\n";
$reqd = array('name', 'email', 'phone', 'phonetype1', 'petname');
$disregard = array('post', 'Appointment_Mail_');
$breaks = array('break', 'break2', 'break3');
foreach($_POST as $key=>$value)
{
	if (in_array($key, $reqd) && $value == '')
	{
		$error .= '- Fill out '.$key.'<br />';
	}
	elseif (!in_array($key, $disregard))
	{
		if (in_array($key, $breaks))
		{
			$message .= "\n";
		}
		else
		{
			$message .= ucwords($key).": ".stripslashes($_POST[$key])."\n";
		}
	}
}
if ($error == '')
{
	mail('fetch@domain.com', $subject, $message, 'From: domain.com <noreply@domain.com>');
	header('Location: http://www.domain.com/thanks.html');
	die();
}
else
{
	$error = 'Please correct the following errors:<br />'.$error;
}
}
?>

Link to comment
Share on other sites

Thanx for the fast reply, perhaps I wasn't clear enough, the end user ( recipient) wants to be able to hit reply and have it reply to the email address that was entered into the form from the visitor, so in essence the address will always be different . I have read the header documentation about 377 times now, and it's still not sinking into my thick head.

Link to comment
Share on other sites

Ok, how about this:

 

mail('fetch@domain.com', $subject, $message, "From: domain.com <noreply@domain.com>\r\nReply-To: {$_POST['email']}");

 

Then someone clicking "Reply" after receiving this email should have the reply sent to the email address entered in the form.. is that what you are looking for?

Link to comment
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.