Jump to content

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 = '[email protected]';
$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('[email protected]', $subject, $message, 'From: domain.com <[email protected]>');
	header('Location: http://www.domain.com/thanks.html');
	die();
}
else
{
	$error = 'Please correct the following errors:<br />'.$error;
}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/260296-reply-to-header/
Share on other sites

The "From" address is specified as [email protected].  If you want them to be able to reply then that should be the address you want them to reply to.

 

Edit: Or, you can use a reply-to header.  There is an example here: http://php.net/manual/en/function.mail.php

Link to comment
https://forums.phpfreaks.com/topic/260296-reply-to-header/#findComment-1334161
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
https://forums.phpfreaks.com/topic/260296-reply-to-header/#findComment-1334163
Share on other sites

Ok, how about this:

 

mail('[email protected]', $subject, $message, "From: domain.com <[email protected]>\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
https://forums.phpfreaks.com/topic/260296-reply-to-header/#findComment-1334165
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.