Hi, can i change the form email from field? client dislikes

Permalink 3 users found helpful
Hi,

I have a a couple of forms on my client's website for applying online for classes. It's set up so that she is emailed with each submission, she likes to be able to email people back and what she does is hit reply. This then ends up sending an email back to me, i get the reply instead of the person who submitted the form, it told her that she will have to copy the answer to the email question on the form and send her replies to that. But this is a little tedious and she sometimes forgets, sending me lots of replys. Any idea as to how i can set the form up so that on reply it sends back to the email address submitted? or at least change the from on the email to something other than my personal email address.

Thanks much

View Replies:
Tony replied on at Permalink Reply
Tony
at this point you'd have to override the current form block and hack at it to get the user's email in the reply field.
stressdesign replied on at Permalink Reply
stressdesign
the from address seems to be in helpers/mail.php, 1ine 125.

$from = 'XXXXXXX@' . str_replace(array('http://', 'https://'), '', BASE_URL);


change XXXXXXX@ to the address you want site e-mails to come from
plschneide replied on at Permalink Reply
plschneide
Any idea of how to grab a specific field from the form (e.g., email) that a user submitted and replaced that with the default field?

Course maybe this is not where to do it. I am thinking of the "notify person of email report and having that from changed to be basically the email field (whoever submitted it). As is, kinda annoying to not be able to "hit reply"
cbenci replied on at Permalink Reply
+1.

Being able to pick a field as the 'reply to' in the email form would make this form the best.

This can be a real deal breaker for most of my clients, most just want to click 'reply to' and start typing.
mrnoisy replied on at Permalink Reply
mrnoisy
+1
mrnoisy replied on at Permalink Reply
mrnoisy
/concrete/blocks/form/controller.php

line 322

change from:
$mh->from( $formFormEmailAddress );

to:
foreach ($_POST as $key => $value){
   if (strstr($value,'@')){
      $mh->from($value);
   } else {
      $mh->from($this->formFormEmailAddress); 
   }
}

This will use the email address in any form field as the from field on the notification email (looks for the @ sign).
plschneide replied on at Permalink Reply
plschneide
This looks like it would do the trick, but I added it in and it hasn't seemed to make a difference. I was thinking I might have put the file in the wrong folder, but I went ahead and just overwrote the one in the concrete folder when it didn't work, and that didn't seem to do the trick either.

Any suggestions?
SigmaAlphaPi replied on at Permalink Reply
SigmaAlphaPi
Couldn't that just be put in a reply-to in the mail's header.

How or where could that be done?

I'm experiencing the same problems as many others do.
mrnoisy replied on at Permalink Reply
mrnoisy
Well, that previous code doesn't seem to work all the time, so here's a hack that will work for a certain form field only.

/concrete/blocks/form/controller.php
line 319

replace:
if( strlen(FORM_BLOCK_SENDER_EMAIL)>1 && strstr(FORM_BLOCK_SENDER_EMAIL,'@') ){
               $formFormEmailAddress = FORM_BLOCK_SENDER_EMAIL;  
            }else{ 
               $adminUserInfo=UserInfo::getByID(USER_SUPER_ID);
               $formFormEmailAddress = $adminUserInfo->getUserEmail(); 
            }


with:
$formFormEmailAddress = $_POST['Question28'];

(Replace Question28 with your own email field name.)
mose replied on at Permalink Reply
mose
I have submitted a patch to mail.php that allows it to handle a Reply-To address, just like a To or From address. The form block would still need to be updated to use it, but if the patch is accepted, the tool will be in the toolbox.
yashvit replied on at Permalink Reply
any news on the patch being approved??

i have tried hackin in some code in the controller to change the from address. it wont work for me as i'm using SMTP. php mail hasnt ever worked for me. something tells me its my webserver.
Remo replied on at Permalink Reply
Remo
@Mose, could you please post the patch as long as it hasn't been integrated into Concrete5?

Being able to set the reply-to address seems like an important thing..
djes replied on at Permalink Reply
djes
Small hack :
Add an "Email" question in your form. Be sure to name it Email.
Add this at line 310
if ($row['question'] == 'Email')
  $formFormSenderEmail = $questionAnswerPairs[$row['msqID']]['answer'];

Change line 331 from
$mh->from( $formFormEmailAddress );
to
$mh->from( $formFormSenderEmail );
wendysandsheds replied on at Permalink Reply
This didn't work for me!

I assume you refering to concrete/blocks/form/controller.php ?
mrnoisy replied on at Permalink Reply
mrnoisy
I use the extended form block now, saves messing around with hacks.
http://www.concrete5.org/marketplace/addons/extended-form/...
twomoons replied on at Permalink Reply
twomoons
Hi, We bought Extended Form but it doesn't seems to reply to the sender's email, it is still replying to the admin email.

How did you get it to work? Do you mind to share please?

Thanks!
jordanlev replied on at Permalink Reply
jordanlev
I would try posting this to the support forum for the Extended Form addon -- go here:
http://www.concrete5.org/marketplace/addons/extended-form/...
...and click "Support" in the sidebar.
helenmarie replied on at Permalink Reply
Has anyone actually managed to get this working on the standard form? All the posts above seem to say that the hacks dont work? and theres no point buying the extended version if that does not set the reply to field either?
plschneide replied on at Permalink Reply
plschneide
FYI I've used the extended form for a few different sites. It DOES allow you to specify a from address. I actually forgot to turn that on and people were replying to form data to me - didn't want that, so I went in and was able to specify the from as being from another address.
kesnav replied on at Permalink Reply
Hey everyone, this is how you can change the "from" email:

http://www.concrete5.org/documentation/how-tos/developers/add-abili...
envisage replied on at Permalink Reply
envisage
I can't get this to work. I must be doing something wrong...any help is greatly appreciated.

updates/concrete 5.5.2.1/concrete/blocks/form/controller.php

}
            }elseif($row['inputType']=='text'){
               $answerLong=$txt->sanitize($_POST['Question'.$row['msqID']]);
               $answer='';
            }elseif($row['inputType']=='fileupload'){
                $answer=intval( $tmpFileIds[intval($row['msqID'])] );
            }elseif($row['inputType']=='url'){
               $answerLong="";
               $answer=$txt->sanitize($_POST['Question'.$row['msqID']]);
            }elseif($row['inputType']=='email'){
               $answerLong="";
               $answer=$txt->sanitize($_POST['Question'.$row['msqID']]);
               $fromEmail=$answer;
            }elseif($row['inputType']=='telephone'){
               $answerLong="";


}  
            $mh = Loader::helper('mail');
            $mh->to( $this->recipientEmail ); 
            $mh->from( $fromEmail ); 
            $mh->addParameter('formName', $this->surveyName);
            $mh->addParameter('questionSetId', $this->questionSetId);
            $mh->addParameter('questionAnswerPairs', $questionAnswerPairs); 
            $mh->load('block_form_submission');
            $mh->setSubject(t('%s Form Submission', $this->surveyName));
            //echo $mh->body.'<br>';
            @$mh->sendMail(); 
         }
kesnav replied on at Permalink Reply
Hi envisaje, try overriding the core files using concrete5 directory override structure. i.e. put the modified file in:

<site_root>/blocks/form/controller.php
envisage replied on at Permalink Reply
envisage
THANK YOU! That did the trick. All is working now.