Customizing the Contact Form Module - Set their Email as Reply-to Address

The Contact Form Module for Exponent CMS automatically sets the reply address for the contact form to be info@yourdomain.com, which is useless because the email you can't reply to the email you get from the site. This tweak will change the reply-address to the email address that they entered, so you can just reply to the email.

First, open exponentroot/modules/contactmodule/actions/contact.php in a text editor. If you cannot edit them directly on the server, first download this file, make your changes, save it again, and upload it. I recommend that you use Filezilla as your FTP client.

Find the line:

$headers = array();

Above this line, insert

//hack to make reply-to the email that they entered
$config->replyto_address = $_POST['email'];
//make the from address the email that they entered
$config->from_address = $_POST['email'];
//make their name the name they entered (for your address book)
$config->from_name = $_POST['name'];

Thats it! Leave a comment if you have any questions or suggestions.

Rate this Tutorial

Rate this Tutorial:

Current Rating:

4 out of 54.17/ 5.00 with 6 votes.

Current Comments

0 comments so far (post your own)

Leave your comment:

Learn how to add this comment form to your site with our comment form tutorial!

Name:

Email:

URL:

Comments:


 
Guess the letters and numbers
(passphrase riddle)
--
0 chars before J;
small 'E' +3 letters
and then
/S/
,
"B"
,
small 'R' +2 letters
followed by
→ retype that here
Enter the correct letters and numbers from the image into the text box. This small test serves as access restriction against malicious bots. Simply reload the page if this graphic is too hard to read.
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.