GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   php coders, I need your help... (https://gfy.com/showthread.php?t=452079)

austinth 04-04-2005 03:59 PM

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 04-04-2005 04:00 PM

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"

pstation 04-04-2005 04:28 PM

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 04-04-2005 04:30 PM

er oops pasted wrong thing lol

xl11 04-04-2005 04:41 PM

something is wrong with this variable -> $http_referrer
post code of the form that you use with this script

xl11 04-04-2005 04:46 PM

try something like this mail($SendTo, $SubjectLine, $MsgBody, "From: $emailaddress\n");

austinth 04-04-2005 04:48 PM

Quote:

Originally Posted by xl11
try something like this mail($SendTo, $SubjectLine, $MsgBody, "From: $emailaddress\n");

that didn't work either. :(

austinth 04-04-2005 04:49 PM

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>

vysniukas 04-04-2005 04:51 PM

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

swedguy 04-04-2005 04:52 PM

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.

swedguy 04-04-2005 04:52 PM

Ok, it looks like it is called: "emailaddress" so change it to that.

vysniukas 04-04-2005 04:54 PM

this will help:
mail($SendTo, $SubjectLine, $MsgBody, "From: ".$_REQUEST["emailaddress"]);

vysniukas 04-04-2005 04:55 PM

and by the way,
$SubjectLine = "subject"; here changes the subject line

austinth 04-04-2005 04:56 PM

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!

xl11 04-04-2005 04:56 PM

ok, it works now

ssp 04-04-2005 04:59 PM

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. :upsidedow

austinth 04-04-2005 05:02 PM

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?

swedguy 04-04-2005 05:03 PM

<?

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

That the $SubjectLine you need to change.

austinth 04-04-2005 05:08 PM

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?

swedguy 04-04-2005 05:31 PM

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

austinth 04-04-2005 05:46 PM

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. :thumbsup

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. :winkwink:


All times are GMT -7. The time now is 03:01 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123