Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
How can I make website viewer's e-mail automatically input when I press respond on
Old 04-18-2009, 07:44 PM How can I make website viewer's e-mail automatically input when I press respond on
Experienced Talker

Posts: 41
Name: Crystal
Location: Beverly Hills
Trades: 0
I have this code I'm using

I'm not a php coder, I took this code from a website. I was wondering how I can make it automatically make the website viewers e-mail automatically input when I press reply. I notice when I press reply in my yahoo e-mail this is what I get

"CGI-Mailer" <cgi-mailer@perfora.net>

so I have to manually copy the person's e-mail.


<?php
if(isset($_POST['submit'])) {

$to = "mmcx200909@yahoo.com";
$subject = "MAJOR FORM";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];

foreach($_POST['check'] as $value) {
$check_msg .= "Checked: $value\n";
}

$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";

echo "Your e-mail has been successful sent! You may close out of your browser.";
mail($to, $subject, $body);

} else {

echo "blarg!";

}
?>
__________________
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

majormusic is offline
Reply With Quote
View Public Profile Visit majormusic's homepage!
 
 
Register now for full access!
Old 04-18-2009, 08:18 PM Re: How can I make website viewer's e-mail automatically input when I press respond o
anderswc's Avatar
Super Talker

Posts: 132
Name: Will Anderson
Location: Terre Haute, IN
Trades: 0
the mail function accepts another field called "header" which allows you to specify the header for the email being sent. You can use this to set who the email is from. Here's the code

<?php
if(isset($_POST['submit'])) {

$to = "mmcx200909@yahoo.com";
$subject = "MAJOR FORM";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];

foreach($_POST['check'] as $value) {
$check_msg .= "Checked: $value\n";
}

$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";

$header = "FROM: $email_field";

echo "Your e-mail has been successful sent! You may close out of your browser.";
mail($to, $subject, $body, $header);

} else {

echo "blarg!";

}
?>
__________________
Will Anderson

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
anderswc is offline
Reply With Quote
View Public Profile Visit anderswc's homepage!
 
Old 04-18-2009, 08:27 PM Re: How can I make website viewer's e-mail automatically input when I press respond o
Experienced Talker

Posts: 41
Name: Crystal
Location: Beverly Hills
Trades: 0
Thank you very much. It worked.
__________________
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

majormusic is offline
Reply With Quote
View Public Profile Visit majormusic's homepage!
 
Old 04-20-2009, 01:03 PM Re: How can I make website viewer's e-mail automatically input when I press respond o
Novice Talker

Posts: 12
Trades: 0
Quote:
Originally Posted by majormusic View Post
Thank you very much. It worked.
Few Other Tricks you can add to headesr

Headers are separated by a "\r\n"
ie:"From: myplace@here.com\r\nReply-To: myplace2@here.com"



From: myplace@here.com
Reply-To: myplace2@here.com
Return-Path: myplace@here.com
CC: sombodyelse@noplace.com
BBC: hidden@special.com
X-Priority: 1 (Highest)
X-MSMail-Priority: High
Importance: High

There are many many more... Enjoy
__________________
Reliable and Legal
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
?
Find A Paralegal Fast.

Please login or register to view this content. Registration is FREE
sjenkins is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How can I make website viewer's e-mail automatically input when I press respond on
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.16216 seconds with 12 queries