Forms - sent to sender?

Hi All,

I’ve just been asked to set up a enquiry form, where-by when it is submitted a copy of the completed form goes to both the person who filled it in, and the company who they are sending the form to.

Working on the idea that there is a field on the form for the person to fill out their email address.

I would imagine this has been asked before. But I can only think of long winded ways of asking the question so can’t seem to find a relevant answer.

Many thanks,

Keith

Sure, you just need to add the email of the sender as a cc:

Two places to look at for more information are this email wizard:

And the php manual for mail:
http://php.net/manual/en/function.mail.php

If you want to do something fancier, you can also use phpMailer:
http://phpmailer.worxware.com/

Thanks for the reply. I’ve had a look through the links you sent me but can’t seem to find the relevant details, I’m sure this is me being stupid. Maybe to many snow balls have hit me on the head today?

I would imagine that the form would have to be php to solve this problem which i’m ok with. The first link that was attached I can download a basic php form which I am ok to adapted, but can’t seem to find the code I would need to include that say send a copy of this form to the email address that has been entered into the form.

Many thanks for the response.

Hi Q,

This example below is copied from the mail() page on php.net.
Notice how cc is used in the headers.

You can store the recipients email in a variable like $from_email and change the code below to:

$headers .= ‘Cc: $from_email’ . "\r
";

<?php
// multiple recipients
$to  = 'aidan@example.com' . ', '; // note the comma
$to .= 'wez@example.com';

// subject
$subject = 'Birthday Reminders for August';

// message
$message = '
<html>
<head>
  <title>Birthday Reminders for August</title>
</head>
<body>
  <p>Here are the birthdays upcoming in August!</p>
  <table>
    <tr>
      <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
    </tr>
    <tr>
      <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
    </tr>
    <tr>
      <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
    </tr>
  </table>
</body>
</html>
';

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\\r\
";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\\r\
";

// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\\r\
";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\\r\
";
[COLOR="Purple"]$headers .= 'Cc: [email]birthdayarchive@example.com[/email]' . "\\r\
";
[/COLOR]

// Mail it
mail($to, $subject, $message, $headers);
?>

E

Apologies for not replying earlier.

Just wanted to say a quick thank you for highlighting the relevant details in the link.

From this I have managed to sort out the form. Just need to add a bit of styling now. Though have a couple of links to work from.

Keith