Could you please tell me how to change the php code for the contact form below? 1. I need the sender's email to populate the address field so that when I hit reply (after I receive their email message), the sender's email address is in the reply field instead of webmaster@example.com?2. If possible, I would also like the sender's email that they type in to show up in my email box so that it shows from the person's email that sent the email in the from column in my email box instead of webmaster@example.com?Thank you for any help.I can't post the code. How do I disply the code for you to see?
I'm assuming the sender of the email inputs their own email somewhere in the form which populates this PHP-scrpt. Simply exchange the with the variable containing the user's email. As it is in the script you sent, you replace this: $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . Code (markup): with $headers = 'From: '.$variable_with_user_email.'' . "\r\n" . 'Reply-To: '.$variable_with_user_email.'' . "\r\n" . Code (markup):
Thanks for the responses. PoPSiCLe, appreciate the code. Sorry I can't paste code directly into this message so I attached the changed code (which may or may not be the correct code changes).I changed the code like you said and it seems to work .When I receive the email sent from the contact line, on the From: line, it lists the person's name that completed the form in the From box and unfortunately following the name that the person typed in, l it lists my main hosting account name & hosting company instead of the domain that the contact form is associated with. How can I change the code to list the domain this form is in on or how can I remove it completely from populating the From: line? I pasted the From line from the email received below; hopefully, the line will show in this message. From: namefilledputonform < mainhostingaccount @ host910.hostingcompany. com> There is also a contact_form.js file if you need to see it. If you like, I'll send you some payment via PayPal for your help. Thanks again.
It seems it has to do with the overall formatting, and/or the host's server setup. Take a look at this thread: http://stackoverflow.com/questions/2014081/problem-with-php-mail-from-header and see if there's somethings there which might help you.
Replace $headers = 'From: '.$_POST['name'].'' . "\r\n" . with $headers = 'From: "'.$_POST['name'].'" <' . $_POST['email'] . ">\r\n" . if this doesn't work then your host doesn't allow sending mail as fake addresses.