473,775 Members | 2,583 Online
Bytes | Software Development & Data Engineering Community
+ 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***@deahippr ovider.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 1679
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.comwr ote:
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...@deahippr ovider.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
2712
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 hard coded address. When I actually input two addresses, it sends to both. The partial code reads: Set objMail = CreateObject("CDONTS.NewMail") objMail.From= request.form("youremail") 'Specify sender's address...
2
2422
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 hard coded address. When I actually input two addresses, it sends to both. The partial code reads: Set objMail = CreateObject("CDONTS.NewMail") objMail.From= request.form("youremail") 'Specify sender's address...
20
2106
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 the constant variable and if I changed the value through the pointer, the constant variable should have been modified. Well, that's what I thought until I wrote the following and run it. #include <iostream> using std::cout; using std::endl;
2
2810
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 String("id,callername,address,phone,phoneb,email,sqft,source,action,status"); var myFields = myString.split(','); //myValues is an array of values passed to the function var myValues =
5
14114
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> #include<stdlib.h> int main(void) { int y = { 7, 9,10},i; for (;i<20;i++)
14
1924
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 will be holded in register so is there any rules to precize when using them thanks
3
1760
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
1802
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: myMail.To = areaDirector it doesn't work. I did a reponse.write on the areaDirector and it comes out like it's supposed to: webster@thisplace.org Any ideas? Does it have something to do with the quote marks?
7
1516
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 on. (I have 8 fields for every person, 80 values in all).
3
2382
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 panel. The central panel is intended to display the main content of the cv: when an anchor is selected from the header then the detail is supposed to appear. The javascript is supposed to select the appropriate section 'onclick' and output it....
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10107
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10048
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9916
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8939
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5360
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4017
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2853
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.