473,472 Members | 2,241 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Variable email address

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"];

?>
Nov 30 '07 #1
1 1664
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.comwrote:
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"];

?>
Nov 30 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Len Burman | last post by:
I have some code in a form which inputs a friends email address and when you submit it sends the message to the person at the address. I want to be able to email to the variable name and also a...
2
by: Len Burman | last post by:
I have some code in a form which inputs a friends email address and when you submit it sends the message to the person at the address. I want to be able to email to the variable name and also a...
20
by: CoolPint | last post by:
While I was reading about const_cast, I got curious and wanted to know if I could modify a constant variable through a pointer which has been "const_cast"ed. Since the pointer would be pointing to...
2
by: Scott | last post by:
I need to write a function that copies variables to fields. I've used an array and loop because it's neater than writing a similar sentence out 10 times. var myString = new...
5
by: dam_fool_2003 | last post by:
Hai, I studied that the array size is fixed. But I come across a word called "variable length array". Is it possible to change the array size? So I tried the following: #include<stdio.h>...
14
by: macluvitch | last post by:
Hello folks I often use register variables within functions (or as funcion parameters) that reauired speed like searching for example . I know that it doesn't mean that every register variable...
3
by: Shapper | last post by:
Hello, I have an aspx.vb code with a function. In this function I need to check if a variable is a valid email address. Something like: address@domain.extension How can I do this? Thanks,
4
by: Jess | last post by:
Has anyone been able to use a variable for the To: line with CDOSYS? When I put in a specific address like: myMail.To = "webster@thisplace.org" it works fine. When I put in a variable like:...
7
by: Garry Jones | last post by:
I have an entry page which can be used to key in data for ten people. My assigned variables for each field are in line with $personage1 $personage2 ....etc $personage9 $personage10 and so...
3
by: bloc | last post by:
I am programming an interactive CV using xml, xslt and java script. The page consists of a header which contains links to various 'sections' on the xml cv, a left and right menu, and a central...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.