On my website I have a contact form, where the user can report bugs or submit feature requests. The form contains a subject and message.
I want the form to email me directly, either with PHPMailer or with PHP's built-in mail function.
The issue here is when generating the email, the sender has to be an address I own, not the actual user's email address. The reason for this is obvious, since we shouldn't be allowed to impersonate other people. However I want to be able to email my users back directly from my inbox, which I can't do since I can't use their address to email myself in the script.
What is the best way to construct the contact form then?
The only workaround I can think of is to insert the message + sender address into a database, and then read it manually from there....an epic hassle.
I would be grateful for any suggestions.
Reply-To e-mail header, so you'll get something like this:
<?php $headers = 'From: firstname.lastname@example.org' . "\r\n"; // Set the sender address as Reply-to below $headers .= 'Reply-To: email@example.com' . "\r\n"; mail('firstname.lastname@example.org', 'Subject here', 'The message goes here', $headers); ?>
This way you will be the sender, but when you hit the reply button in your mail client, it will default to reply to the address listed in the