scurred Posted July 9, 2007 Share Posted July 9, 2007 First off, I don't know PHP...But my coder is on vacation and I need a customers site fixed! heres the problem: customer wants to be able to click reply and send a message to the person that filled out the form, currently when he replies it adds the email address from the server the script is being hosted on. is there anyway I can make it so that if he replies it is sent to the email address aquired from the form? Here is the form code... <FORM METHOD="POST" ACTION="act_sendMail.php"> <H3>Online Form</H3> Use this form to send us your questions or to make a reservation. We'll contact you to answer your questions or confirm your reservation and to secure your booking with a credit card number. <P> <INPUT TYPE="radio" NAME="type" VALUE="Reservation" Checked><B>Reservation</B> <INPUT TYPE="radio" NAME="type" VALUE="Question"><B>Question</B> <INPUT TYPE="radio" NAME="type" VALUE="Other"><B>Other</B> <P> <B>Name:</B> <input name="name" value="" size=30 maxlength=255> <BR><B>Email:</B> <input name="email" value="" size=30 maxlength=255><BR> <BR><B>Mailing Address:</B> <input name="address" value="Street or PO Box" size=50 maxlength=255> <DD><input name="address2" value="Town, State, ZIP" size=60 maxlength=255> <BR><B>Phone Number:</B> <input name="phone" value="" size=30 maxlength=255> <P> <IMG SRC="pics/eagles.jpg" ALIGN=RIGHT WIDTH="192" HEIGHT="134" HSPACE="10" VSPACE="10"> <B>Dates Desired:</B> <DD>Arrival Date: <input name="arrival_date" value="" size=10> Arrival Time: <input name="arrival_time" value="" size=10> <DD>Method of Arrival:<SELECT NAME="transport"> <OPTION>Ferry <OPTION>Air <OPTION>Road </SELECT> <DD>Date of Departure: <input name="departure_date" value="" size=18 maxlength=255> <DD>Number of Guests: <input name="guests" value="" size=10> <P> <B>Room Desired</B><BR> <DD><INPUT TYPE="radio" NAME="room" VALUE="Single">Single <DD><INPUT TYPE="radio" NAME="room" VALUE="Double">Double <DD><INPUT TYPE="radio" NAME="room" VALUE="Twin">Twin <DD><INPUT TYPE="radio" NAME="room" VALUE="Any">Any <P> <DD><INPUT TYPE="radio" NAME="smoking" VALUE="Smoking">Smoking <DD><INPUT TYPE="radio" NAME="smoking" VALUE="Non-Smoking">Non Smoking <P> <B>Comments and Messages:</B> <textarea input name="comments" rows=4 cols=73>Share your thoughts with us or ask your questions here.</textarea> <P> <CENTER> <input type="submit" value="Send to the Thunderbird Motel"> <input type="reset" value="Clear this Form"> </CENTER><P> </FORM> and here is the PHP code...(act_sendMail.php) <? $emailMsg[ 'to' ] = '[email protected] '; $emailMsg[ 'from' ] = '[email protected]'; $emailMsg[ 'subject' ] = 'New Contact Request'; $emailMsg['body'] .= "\nType of Contact Request: ".$_POST['type' ]; $emailMsg[ 'body' ] .= "\nName: ".$_POST[ 'name' ]; $emailMsg[ 'body' ] .= "\nEmail Address: ". $_POST[ 'email' ]; $emailMsg[ 'body' ] .= "\nMailing Address: ". $_POST[ 'address' ]; $emailMsg[ 'body' ] .= "\n ". $_POST[ 'address2' ]; $emailMsg[ 'body' ] .= "\nPhone Number: ". $_POST[ 'phone' ]; $emailMsg[ 'body' ] .= "\n\nArriving: ". $_POST[ 'arrival_date' ]. ", at " . $_POST[ 'arrival_time' ] ." Via ". $_POST[ 'transport' ]; $emailMsg[ 'body' ] .= "\nDeparting: ". $_POST[ 'departure_date' ]; $emailMsg[ 'body' ] .= "\nNumber of Guests: ". $_POST[ 'guests' ]; $emailMsg[ 'body' ] .= "\nRoom Preference: ". $_POST[ 'room'] ." - ". $_POST[ 'smoking' ]; $emailMsg[ 'body' ] .= "\n\nComments: " . $_POST[ 'comments' ]; $mailSuccess = mail( $emailMsg[ 'to' ], $emailMsg[ 'subject' ], $emailMsg[ 'body' ]); if( $mailSuccess ){ ?> <script> alert( 'Thank you for contacting us. We will respond as soon as possible. Have a good day.' ); top.location = "./"; </script> <? }else{ ?> <script> alert( "We're sorry, but there was an error while processing your request. Please try again later, or give us a call. Thank you." ); back(); </script> <? } ?> Any help would be awesome, thanks in advance! -Scurred. Link to comment https://forums.phpfreaks.com/topic/59003-help-with-php-script-regarding-email/ Share on other sites More sharing options...
Yesideez Posted July 9, 2007 Share Posted July 9, 2007 The email script sends the email to "matt.c" and if the recipient replies to it, it'll go to "reservation" If you reply to the recipient's reply then it'll go back to "matt.c" - isn't this what you want to do? Link to comment https://forums.phpfreaks.com/topic/59003-help-with-php-script-regarding-email/#findComment-292841 Share on other sites More sharing options...
scurred Posted July 9, 2007 Author Share Posted July 9, 2007 Thats not whats happening though...and its not what I need it to do when I reply.... it replies to [email protected] (the server its being hosted on) "reservation" is no where on the email or header i receive... I'm thinkin all I should have to do is tell it what the return path should be (and that return patch should be what was filled out in the email section of the form) but I'm an idiot remember Thanks for the quick response btw! Link to comment https://forums.phpfreaks.com/topic/59003-help-with-php-script-regarding-email/#findComment-292853 Share on other sites More sharing options...
scurred Posted July 9, 2007 Author Share Posted July 9, 2007 bump? Link to comment https://forums.phpfreaks.com/topic/59003-help-with-php-script-regarding-email/#findComment-293550 Share on other sites More sharing options...
Yesideez Posted July 9, 2007 Share Posted July 9, 2007 $mailSuccess = mail( $emailMsg[ 'to' ], $emailMsg[ 'subject' ], $emailMsg[ 'body' ],$emailMsg['from']); You forgot to include the "from" which is really the header. EDIT: Changed "From" to "from" to keep case the same. Link to comment https://forums.phpfreaks.com/topic/59003-help-with-php-script-regarding-email/#findComment-293561 Share on other sites More sharing options...
scurred Posted July 9, 2007 Author Share Posted July 9, 2007 added in your suggestion, and it hasn't made a difference.. its like the $emailMsg[ 'from' ] = '[email protected]'; isn't doing a damn thing... problem is still that the server is sending it as the user ([email protected]) instead of whats specified in the from line. also would this be the correct syntax $emailMsg[ 'from' ] = $_POST [ 'email' ]; to try and make the from line contain the email address submitted by the form? Thanks again Yesideez! Link to comment https://forums.phpfreaks.com/topic/59003-help-with-php-script-regarding-email/#findComment-293596 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.