Jump to content

email to sender as well as myself (code inside)


theunavailablename

Recommended Posts

I am trying to get the email to be sent to the person sending the email, not just myself. i put $email in for the contact but its not working and i dont know what else might do it.

if $email isnt working what is the code that could do it, if im even puting it in the right spot.

thanks

-S

*note* this is just the top part of the php code.

[code]/* ========================= Begin Configuration ============================ */
define("kContactEmail","name@website.com, $email");
  /* ========================= End Configuration ============================== */

  // init variables
$error_msg = 'The following fields were left empty or contain invalid information:<ul>';
$error = false;

// determine is the form was submitted
$submit = $_POST['submit'];
if (empty($submit))
$form_submitted = false;
else
  $form_submitted = true;

  if ($form_submitted) {
  // read out data
  $name = $_POST['name'];
$company = $_POST['company'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$game1 = $_POST['game1'];
$game2 = $_POST['game2'];
$game3 = $_POST['game3'];
$game4 = $_POST['game4'];
$game5 = $_POST['game5'];
$game6 = $_POST['game6'];
$game7 = $_POST['game7'];
$game8 = $_POST['game8'];
$game9 = $_POST['game9'];
$game10 = $_POST['game10'];
$game11 = $_POST['game11'];
$game12 = $_POST['game12'];
$game13 = $_POST['game13'];
$game14 = $_POST['game14'];
$game15 = $_POST['game15'];
$game16 = $_POST['game16'];
$message = $_POST['message'];


// verify required data
if(!$name) { $error_msg .= "<li>Full Name</li>"; $error = true; }
if(!$email) { $error_msg .= "<li>E-mail Address</li>"; $error = true; }
if(!$subject) { $error_msg .= "<li>Subject</li>"; $error = true; }
if(!$message) { $error_msg .= "<li>Message</li>"; $error = false; }
if($email) { if(!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$", $email)){ $error_msg .= "<li>E-mail Address</li>"; $error = true; }}
$error_msg .= "</ul>";

// email message if no errors occurred
if (!$error) {
      // prepare message
$msg  = "Full Name: \t $name \n";
$msg .= "E-mail Address: \t $email \n";
$msg .= "Game1: \t $game1 \n";
$msg .= "Game2: \t $game2 \n";
$msg .= "Game3: \t $game3 \n";
$msg .= "Game4: \t $game4 \n";
$msg .= "Game5: \t $game5 \n";
$msg .= "Game6: \t $game6 \n";
$msg .= "Game7: \t $game7 \n";
$msg .= "Game8: \t $game8 \n";
$msg .= "Game9: \t $game9 \n";
$msg .= "Game10: \t $game10 \n";
$msg .= "Game11: \t $game11 \n";
$msg .= "Game12: \t $game12 \n";
$msg .= "Game13: \t $game13 \n";
$msg .= "Game14: \t $game14 \n";
$msg .= "Game15: \t $game15 \n";
$msg .= "Game16: \t $game16 \n";
$msg .= "Message: \n---\n $message \n---\n";

// prepare message header
$mailheaders  = "MIME-Version: 1.0\r\n";
$mailheaders .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$mailheaders .= "From: $name <$email>\r\n";
$mailheaders .= "Reply-To: $name <$email>\r\n";

  // send out email
mail(kContactEmail, $subject ,stripslashes($msg), $mailheaders);
}
}
?>
<html>
<head>

<title>Contact Us</title>
<style type="text/css">
<!--
td.form        { color: #efefef; font-family: "Verdana","Arial"; font-size: 11; }
td.main        { color: #efefef; font-family: "Verdana","Arial"; font-size: 12; }
font.form_check { color: ff0000; }
input          { font-family: "Verdana","Arial"; color:#606060; font-size: 11px; }
textarea        { font-family: "Verdana","Arial"; color:#606060; font-size: 11px; }
div#form_box    { margin: 2px; width: 400px; border: 0px; border-style: solid; border-color: #C37D3F; background: #000000; padding: 5px; }
h1              { font-size:16; color: #606060; }
-->
</style>
</head>
<body>
<!-- box around the page -->
<div id="form_box">
<table border="0" width="400" cellpadding="1" cellspacing="0" height="400">
<tr>
<td class="main" valign="top">
<!-- page heading-->
<center><h1></h1></center>
<?php
// email was successfully send
if (($form_submitted) && (!$error)) {
?>
<!-- display submitted data -->
Thank you for your feedback, <?php echo $name; ?>.
This is the information you submitted:<br><br><?php echo nl2br(stripslashes($msg)); ?>
<?php
}
// display contact form
else {
// display error message
if ($error) {
echo "<font class='form_check'>" . $error_msg . "</font>\n";
}
?>[/code]
Link to comment
Share on other sites

[quote author=onlyican link=topic=106745.msg427414#msg427414 date=1157327679]
Add this under the mail headers

$mailheaders .= 'Bcc: you@domain.tld' . "\r\n";

Replacing you@domain.tld with the email address you want the email BBC to
[/quote]

that works if i want it to just got to one other person other than myself all the time.

but i want it to go to whoever types in their email in the email section. so they get a copy of what they just emailed to me.
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.