Jump to content

PHP message responder


Ashley Webb
 Share

Recommended Posts

Hi, I'm very new to the html game and have made a very simple website for a friend. On the contact page I have a very simple message submitter which works fine barr one fault. It sends the message including the headers but it does not send an automatic repsponse. It is set at the moment to send the message to my email adress so feel free to play. Could someone please take a look at it:

a<?php$to = " xyz ";$subject = "Enquiry from www.reclaimed-antique-wood-flooring.com";$email = $_REQUEST['email'] ;$message = $_REQUEST['message'] ;$headers = "From: $email"; $autoreply = "auto repsonse here";$headers2 = "From: xyz ";$subject2 = "Thank you for contacting us";if($email == ''){header( "Location: /contact-us/no-email-address" );}else{if($message == ''){header( "Location: /contact-us/no-message" );}else  $sent = mail($to, $subject, $message, $headers) ;$sent2 = mail($from, $subject2, $autoreply, $headers2);if($sent){header( "Location: /contact-us/submit-succesful" );}}?>

Thank you very much.

Link to comment
Share on other sites

can you explain more what is not working and what are you trying to do?

Link to comment
Share on other sites

Hi, No it IS sending this: (customer fills out form and it sends it off to x@yz.com)

$to = " xyz ";$subject = "Enquiry from www.reclaimed-antique-wood-flooring.com";$email = $_REQUEST['email'] ;$message = $_REQUEST['message'] ;$headers = "From: $email";

and it IS doing this: (redirecting visitor to xyz depending on input, after submit is clicked)

if($email == ''){header( "Location: /contact-us/no-email-address" );}else{if($message == ''){header( "Location: /contact-us/no-message" );}else $sent = mail($to, $subject, $message, $headers) ;$sent2 = mail($from, $subject2, $autoreply, $headers2);if($sent){header( "Location: /contact-us/submit-succesful" );}}?>

but it ISN'T doing this: (sending a response to visitors email address thanking them for contacting us)

$autoreply = "auto repsonse here";$headers2 = "From: xyz ";$subject2 = "Thank you for contacting us";

Hope that makes sense!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...