Forums

This topic is locked

Feedback form

Posted 23 Feb 2007 10:38:39
1
has voted
23 Feb 2007 10:38:39 Olwyn Rutter posted:
I wondered if anyone can help me. Using the coding below which is on my feedback.php page, I would like to send the form to TWO email addresses. Does anyone know how to add another e-mail address. Thanks for any help. Here is the code for the .php file.


$mailto = ' ' ;

// $subject - set to the Subject line of the email, eg
//$subject = "Feedback Form" ;

$subject = "PlotPerfect Feedback" ;

$formurl = "www.plotperfect.com/feedback1.html" ;
$errorurl = "www.plotperfect.com/error.html" ;
$thankyouurl = "www.plotperfect.com/thankyou.html" ;

$uself = 1;

$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
if (empty($name) || empty($email) || empty($comments)) {
header( "Location: $errorurl" );
exit ;
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
header( "Location: $errorurl" );
exit ;
}

if (get_magic_quotes_gpc()) {
$comments = stripslashes( $comments );
}

$messageproper =

"This message was sent from:\n" .
"$http_referrer\n" .
"------------------------------------------------------------\n" .
"Name of sender: $name\n" .
"Email of sender: $email\n" .
"------------------------- COMMENTS -------------------------\n\n" .
$comments .
"\n\n------------------------------------------------------------\n" ;

mail($mailto, $subject, $messageproper,
"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );
header( "Location: $thankyouurl" );
exit ;

?>

Replies

Replied 23 Feb 2007 17:44:58
23 Feb 2007 17:44:58 Alan C replied:
Hi

$mailto2=' '; // send this to someone else too

sets the second email address that you want to send to

then at the bottom the statement that starts . . .

mail($mailto, $subject . . .

is the one that actually sends the email, so if you duplicate that and change the first parameter from $mailto to $mailto2 it should work

Replied 25 Feb 2007 09:26:54
25 Feb 2007 09:26:54 Olwyn Rutter replied:
I will try that. Thank you for your help.

Reply to this topic