Hack to add a reply-to address or change From address of form

Permalink 1 user found helpful
I want to edit the c5 form controller.php so that form emails are submitted 'from' the person who sent the form (to make them easier to reply to, current set-up is irritating)

This question has been asked before so it obviously frustrates other people but I can't find a satisfactory reply. I've been reading these threads:
http://www.concrete5.org/community/forums/usage/form-issues-attachm...
http://www.concrete5.org/community/forums/usage/hi_can_i_change_the...

and the second thread had useful suggestions but didn't seem to provide a proper answer.

So here's my hack to solve this, I'd like to know if this really is a simple solution or if by doing this I'm going to mess up something I'd not thought of.

In the form controller.php, around line 348, I changed

}elseif($row['inputType']=='email'){
               $answerLong="";
               $answer=$txt->sanitize($_POST['Question'.$row['msqID']]);


to this

}elseif($row['inputType']=='email'){
   $answerLong="";
        $answer=$txt->sanitize($_POST['Question'.$row['msqID']]);
        $formFormSenderEmail = $answer;  // this line is new


since there's only one email field in my form, and that's the one that the form submitter enters (I imagine this is the case for most simple forms?) so it'll put their address in $formFormSenderEmail

Now on line 397-399 I have this:

$mh = Loader::helper('mail');
$mh->to( $this->recipientEmail ); 
$mh->from( $formFormSenderEmail );  // was $mh->from( $formFormEmailAddress );



and this seems to do the trick. Does this sound OK?

I appreciate reply-to may be better (spam? perhaps someone can clarify?) but I don't know how to do that.

prestressed
 
prestressed replied on at Permalink Reply
prestressed
Ahh, I should have looked in the how-tos (thank you doctypedesigner)
This post from Feb pretty much duplicates the above:

http://www.concrete5.org/documentation/how-tos/developers/add-abili...

or alternatively this:
http://www.concrete5.org/documentation/how-tos/designers/email-from...
dpelletier replied on at Permalink Reply
OK, sounds good but in my concrete/blocks/form/controller.php there is only 5 lines.

So am I suppose to add stuff, or am I just looking in the wrong place?

Running Concrete 5.6.0.2
Ekko replied on at Permalink Reply
Ekko
You can instead add a line to you config/site.php

define('FORM_BLOCK_SENDER_EMAIL ','Whatever@what.com')

Whatever you put as whatever@what will become the from email for forms.
dpelletier replied on at Permalink Reply
Thanks...

I found that version 5.6.0.2 already has a reply to checkbox when creating a form.
The check box does not work if the "Email" Quetsion is already in the form.
You need to delete the question and add it new for the checkbox to actually work.

Problem solved
thenine replied on at Permalink Reply
thenine
Yo need to delete that space between EMAIL and last '

otherwise it wont do anything. Good line is

define('FORM_BLOCK_SENDER_EMAIL', 'email@whateverdomain.com');