how recepient to contact form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tonyledenko
Forum Newbie
Posts: 15
Joined: Thu Sep 11, 2008 4:22 pm

how recepient to contact form

Post by tonyledenko »

Hello,

How can I send the form results to the person who fills it out. Currently, I am having it sent to me.

//The email address the message will be sent to
$youremail = "ttttt@ttttt.com";

<?

//Checks to see if the name field is empty. You can delete or add fields as needed.

if ( (!empty($name)))
{

$name = stripslashes($name);
$message = stripslashes($message);
//This is where the email is sent using your values from above.
mail("$youremail", "$subject","$thetext");
?>
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: how recepient to contact form

Post by requinix »

tonyledenko wrote:Currently, I am having it sent to me.
So just change the To address.

Or if you want it send to them as well, copy/paste the mail(...) statement and change the address.
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: how recepient to contact form

Post by JAB Creations »

tasairis, are you suggesting running the same function twice?

tonyledenko, have you tried using either the BCC or CC fields? Also email, email, email format in top field?
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Re: how recepient to contact form

Post by infolock »

tonyledenko wrote:Hello,

How can I send the form results to the person who fills it out. Currently, I am having it sent to me.

//The email address the message will be sent to
$youremail = "ttttt@ttttt.com";

<?

//Checks to see if the name field is empty. You can delete or add fields as needed.

if ( (!empty($name)))
{

$name = stripslashes($name);
$message = stripslashes($message);
//This is where the email is sent using your values from above.
mail("$youremail", "$subject","$thetext");
?>

First of all, you don't need the double quotes (") around the $youremail, $subject, $thetext in the mail function.

Secondly, not sure what the issue is with your code. are you getting errors of some sort? It looks fine to me (execpt your using $thetext instead of $message...)
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: how recepient to contact form

Post by requinix »

JAB Creations wrote:tasairis, are you suggesting running the same function twice?
In so many words, yes. He said that "currently" it was sending the emails to him so he already has something working.
If he wants a copy of the email sent to another person, duplicating the mail() statement after changing the To address should be enough.
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Re: how recepient to contact form

Post by infolock »

Actually, he doesn't need to do that. he could just add CC to the headers... which would make it only one function call instead of 2.

example:

Code: Select all

 
mail("bob@bob.com","subject", "a message", "CC:someone@bob.com");
 
//or, for BCC
 
mail("bob@bob.com","subject", "a message", "BCC:someone@bob.com");
 
// or, for both CC and FROM
 
mail("bob@bob.com","subject", "a message", "From:webmaster@bob.com\r\nCC:someone@bob.com\r\n");
 
 
Post Reply