Home > Archive > PHP Programming > November 2007 > Variable email address
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Variable email address
|
|
| windub 2007-11-30, 7:02 pm |
| Hi...
I would like to capture an email address from a form and send a copy
of the mail to that user. Can anyone give the correct code?
Below is the script I am using.
Thanks for your help.
<?php
/
$sendTo = "peter@deahipprovider.co.uk";
$subject = "New Enquiry";
$headers = "From: " . $_POST["firstname"] ." ". $_POST["lastname"] .
"<" . $_POST["email"] .">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$headers .= "Return-path: " . $_POST["email"];
$message = $_POST["message"];
mail($sendTo, $subject, $message, $headers);
$sendTo = ["email"];
?>
| |
| Acrobatic 2007-11-30, 7:02 pm |
| Your $sendTo isn't really variable, it's set to a static email
address. You might want to change that to
$sendTo = $_POST['email']
before you issue the "mail" command.
On Nov 30, 12:06 pm, windub <peterelliottbr...@gmail.com> wrote:
> Hi...
>
> I would like to capture an email address from a form and send a copy
> of the mail to that user. Can anyone give the correct code?
>
> Below is the script I am using.
>
> Thanks for your help.
>
> <?php
> /
> $sendTo = "pe...@deahipprovider.co.uk";
> $subject = "New Enquiry";
>
> $headers = "From: " . $_POST["firstname"] ." ". $_POST["lastname"] .
> "<" . $_POST["email"] .">\r\n";
> $headers .= "Reply-To: " . $_POST["email"] . "\r\n";
> $headers .= "Return-path: " . $_POST["email"];
>
> $message = $_POST["message"];
>
> mail($sendTo, $subject, $message, $headers);
> $sendTo = ["email"];
>
> ?>
|
|
|
|
|