Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 04-04-2005, 03:59 PM   #1
austinth
Confirmed User
 
Join Date: Jul 2002
Location: Fantasy Island
Posts: 1,770
php coders, I need your help...

how do I get this code to send me an email with the person who is sending it email in the from area of an email, right now it puts my own email address in there so i cant hit reply send. i have to manually copy paste the senders email from the contents of the mail that i receive.

here is the code im using:
<?

// Configuration Settings
$SendTo = "[email protected]";
$SubjectLine = "subject";
$ThanksURL = "thankyou.html"; //confirmation page
$Divider = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";

// Build Message Body from Web Form Input
$MsgBody = @gethostbyaddr($_SERVER["REMOTE_ADDR"]) . "\n$Divider\n";
foreach ($_POST as $Field=>$Value)
$MsgBody .= "$Field: $Value\n";
$MsgBody .= "$Divider\n" . $_SERVER["HTTP_USER_AGENT"] . "\n";
$MsgBody = htmlspecialchars($MsgBody); //make content safe

// Send E-Mail and Direct Browser to Confirmation Page
mail($SendTo, $SubjectLine, $MsgBody, $emailaddress ,"From: $http_referrer\n");
header("Location: $ThanksURL");
?>
austinth is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2005, 04:00 PM   #2
austinth
Confirmed User
 
Join Date: Jul 2002
Location: Fantasy Island
Posts: 1,770
also how do i get to embed the subject line of my email in the subject line of the email being sent instead of: "subject"
austinth is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2005, 04:28 PM   #3
pstation
Confirmed User
 
Join Date: Jul 2003
Location: chicago
Posts: 1,135
PHP Code:
<?

// Configuration Settings
$SendTo = "[email protected]";
$SubjectLine = "subject";
$ThanksURL = "thankyou.html"; //confirmation page
$Divider = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";

// Build Message Body from Web Form Input
$MsgBody = @gethostbyaddr($_SERVER["REMOTE_ADDR"]) . "\n$Divider\n";
foreach ($_POST as $Field=>$Value)
$MsgBody .= "$Field: $Value\n";
$MsgBody .= "$Divider\n" . $_SERVER["HTTP_USER_AGENT"] . "\n";
$MsgBody = htmlspecialchars($MsgBody); //make content safe

// Send E-Mail and Direct Browser to Confirmation Page
mail($SendTo, $SubjectLine, $MsgBody, $emailaddress ,"From: $http_referrer\n");
header("Location: $ThanksURL");
?>
pstation is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2005, 04:30 PM   #4
pstation
Confirmed User
 
Join Date: Jul 2003
Location: chicago
Posts: 1,135
er oops pasted wrong thing lol
pstation is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2005, 04:41 PM   #5
xl11
Confirmed User
 
Industry Role:
Join Date: Jul 2003
Posts: 712
something is wrong with this variable -> $http_referrer
post code of the form that you use with this script
xl11 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2005, 04:46 PM   #6
xl11
Confirmed User
 
Industry Role:
Join Date: Jul 2003
Posts: 712
try something like this mail($SendTo, $SubjectLine, $MsgBody, "From: $emailaddress\n");
xl11 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2005, 04:48 PM   #7
austinth
Confirmed User
 
Join Date: Jul 2002
Location: Fantasy Island
Posts: 1,770
Quote:
Originally Posted by xl11
try something like this mail($SendTo, $SubjectLine, $MsgBody, "From: $emailaddress\n");
that didn't work either.
austinth is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2005, 04:49 PM   #8
austinth
Confirmed User
 
Join Date: Jul 2002
Location: Fantasy Island
Posts: 1,770
Quote:
Originally Posted by xl11
something is wrong with this variable -> $http_referrer
post code of the form that you use with this script
here is the form code:

<form action="feedback.php" method=hahahahahaha>
<table border="0" align="center" cellpadding="8" cellspacing="8" summary="feedback form">
<tr>
<td> <table border="0" cellpadding="8" cellspacing="8" summary="feedback form">
<tr>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Subject:</strong></font></td>
<td><select name="subject" id="subject">
<option value="I have a question about how to order your product." selected>I
have a question about how to order your product.</option>
<option value="I have a question about your product and would like some info.">I
have a question about your product and would like some info.</option>
<option value="I want to know the status of an order I have already placed.">I
want to know the status of an order I have already placed.</option>
<option value="I am not happy with this product and would like a refund.">I
am not happy with this product and would like a refund.</option>
<option value="I have a question regarding your affiliate/webmaster program.">I
have a question regarding your affiliate/webmaster program.</option>
<option value="I need to update my shipping address information.">I
need to update my shipping address information.</option>
<option value="I wish to cancel my order.">I wish to cancel my
order.</option>
<option value="I want wholesale/reseller information about your product.">I
want wholesale/reseller information about your product.</option>
<option value="I received SPAM which appears to be promoting your product.">I
received SPAM which appears to be promoting your product.</option>
</select></td>
</tr>
</table>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Comments</strong></font><br />
<textarea rows="15" cols="65" name="comments">
</textarea>
</p>
<table border="0" cellpadding="8" cellspacing="8" summary="feedback form">
<tr>
<td width="94"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Your Name:</font></strong></td>
<td width="270"><input name="name" type="text" id="name" size="25" /></td>
</tr>
<tr>
<td><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Email Address:</font></strong></td>
<td><input name="emailaddress" type="text" id="emailaddress" size="25" /></td>
</tr>
<tr>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Order
Number:</strong></font></td>
<td><input name="ordernumber" type="text" id="ordernumber" size="25" /></td>
</tr>
</table>

</td>
</tr>
<tr>
<td align="center"> <input type="submit" value="Send Feedback" /> <br />
</td>
</tr>
</table>
</form>
austinth is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2005, 04:51 PM   #9
vysniukas
Confirmed User
 
Join Date: Jul 2004
Location: somethere
Posts: 270
show me the html of your form, i need to see how you store the email address of the visitor. Subject line changes with variable $subject = "type anything here";
__________________
http://www.myadultblogs.com/ - trade hardlinks with my blogs - more than 100 blogs.
vysniukas is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2005, 04:52 PM   #10
swedguy
Confirmed User
 
Industry Role:
Join Date: Jan 2002
Posts: 7,981
If the form variable where the senders email in is called "senderemai", it should look like this:

mail($SendTo, $SubjectLine, $MsgBody, "From: ".$_REQUEST["senderemai"]."\n");

Change "senderemai" to what it is really called.

Last edited by swedguy; 04-04-2005 at 04:53 PM..
swedguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2005, 04:52 PM   #11
swedguy
Confirmed User
 
Industry Role:
Join Date: Jan 2002
Posts: 7,981
Ok, it looks like it is called: "emailaddress" so change it to that.
swedguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2005, 04:54 PM   #12
vysniukas
Confirmed User
 
Join Date: Jul 2004
Location: somethere
Posts: 270
this will help:
mail($SendTo, $SubjectLine, $MsgBody, "From: ".$_REQUEST["emailaddress"]);
__________________
http://www.myadultblogs.com/ - trade hardlinks with my blogs - more than 100 blogs.
vysniukas is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2005, 04:55 PM   #13
vysniukas
Confirmed User
 
Join Date: Jul 2004
Location: somethere
Posts: 270
and by the way,
$SubjectLine = "subject"; here changes the subject line
__________________
http://www.myadultblogs.com/ - trade hardlinks with my blogs - more than 100 blogs.
vysniukas is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2005, 04:56 PM   #14
austinth
Confirmed User
 
Join Date: Jul 2002
Location: Fantasy Island
Posts: 1,770
Quote:
Originally Posted by swedguy
Ok, it looks like it is called: "emailaddress" so change it to that.
swedguy - I LOVE YOU MAN!!!! that worked!
austinth is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2005, 04:56 PM   #15
xl11
Confirmed User
 
Industry Role:
Join Date: Jul 2003
Posts: 712
ok, it works now
xl11 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2005, 04:59 PM   #16
ssp
Confirmed User
 
Join Date: Jan 2005
Location: United Kingdom
Posts: 7,990
Quote:
Originally Posted by austinth
swedguy - I LOVE YOU MAN!!!! that worked!
You should Google up the PHP mail() function and read a bit about it to understand it. It's really simple. Glad you got it working though.
ssp is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2005, 05:02 PM   #17
austinth
Confirmed User
 
Join Date: Jul 2002
Location: Fantasy Island
Posts: 1,770
the email address field is working great.

the subject is still not changing though, here is what i tried:

mail($SendTo, $SubjectLine = "subject", $MsgBody, "From: ".$_REQUEST["emailaddress"]."\n");

this sends the email properly but still doesnt change the subject line and this way:

mail($SendTo, $SubjectLine = "subject";, $MsgBody, "From: ".$_REQUEST["emailaddress"]."\n");

doesn't send out at all.

any ideas?
austinth is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2005, 05:03 PM   #18
swedguy
Confirmed User
 
Industry Role:
Join Date: Jan 2002
Posts: 7,981
<?

// Configuration Settings
$SendTo = "[email protected]";
$SubjectLine = "subject";
$ThanksURL = "thankyou.html"; //confirmation page
$Divider = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";

That the $SubjectLine you need to change.
swedguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2005, 05:08 PM   #19
austinth
Confirmed User
 
Join Date: Jul 2002
Location: Fantasy Island
Posts: 1,770
how do i get that to pull from the list of subjects in the drop down menu on the email form page, instead of the generic 'subject' that it puts in on the feedback php page?
austinth is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2005, 05:31 PM   #20
swedguy
Confirmed User
 
Industry Role:
Join Date: Jan 2002
Posts: 7,981
mail($SendTo, $_REQUEST["subject"], $MsgBody, "From: ".$_REQUEST["senderemai"]."\n");
swedguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-04-2005, 05:46 PM   #21
austinth
Confirmed User
 
Join Date: Jul 2002
Location: Fantasy Island
Posts: 1,770
Thank You!! That did it, it works like a charm, both the email and subject are exactly the way i wanted them be when the form is used.

You just made my day Swedguy, i have been looking around for the right code for this for a while now.

Your help is much appreciated.
austinth is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.