Email form, reply address

Permalink 2 users found helpful
Ok so using the default (or other) contact form in concrete5, i want to be able to set the reply address of the email, to whatever the user enters as their own email, make scene?

currently the form emails from the superuser address, I would like it to mail from the address that is entered in the E-mail field of the block...

Im happy to modify the lock / install addons / change the code etc, i just need to fix it, my client keeps replying to the emails, and they all come through to me!


View Replies:
shadowcomputers replied on at Permalink Reply
If you edit site.php and add:

define('FORM_BLOCK_SENDER_EMAIL', '[email protected]');
wreford replied on at Permalink Reply
Yeah, you didn't answer the original question. You answered a different question: "how do I change the static default sender address (thus the reply to address) to be different from the superuser?"

The original question is about getting a dynamic sender input from the 'email' field that the submitter fills out, and using that as the sender address.

I'm guessing this would require some PHP modification, and I too would like any clues or tip anyone has.
julia replied on at Permalink Reply
Here's a tutorial on how to do that:
Email 'from' field populated using the senders email address
mehreenbaakza replied on at Permalink Reply
Julia, thanks so much!!! I've been looking all over for this solution because my client was tired of the fact that hitting reply on the emails coming from the form block was causing the reply to come to me instead of the sender. Thanks for posting this awesome link!!!!
shiki replied on at Permalink Reply
I can´t seem to get it to work. I have changed to the new code in the controller.php located in concrete/blocks/form. Also changed the code in controller.php in the updates folder (updates/concrete/blocks/form).

Any ideas?
furehead replied on at Permalink Reply 1 Attachment
You might also try this hack:

But I would recommend the following solution:

1) create directory /blocks/form
2) copy the original controller.php from the form block from
/concrete/blocks/form/controller.php to /blocks/form/controller.php
3) modify this new controller.php file (this will overwrite the original controller functions also in case of updates).

how to modify (taken from the above link and modified by me) (version

3a) go to line 351 and add this line:
$replyToMail=$answer; //fix for reply to adress

resulting code from 348 on is:
               $replyToMail=$answer; //fix for reply to adress

3b) Second change:

Go to line 399 and add this code into a new line to set a new ReplyTo Adress:

If you want to change the senders from adress (instead of replyto Adress only) set this instead:

The whole if-Block then looks like this:
if(intval($this->notifyMeOnSubmission)>0 && !$foundSpam){   
            if( strlen(FORM_BLOCK_SENDER_EMAIL)>1 && strstr(FORM_BLOCK_SENDER_EMAIL,'@') ){
               $formFormEmailAddress = FORM_BLOCK_SENDER_EMAIL;  
               $formFormEmailAddress = $adminUserInfo->getUserEmail(); 
            $mh = Loader::helper('mail');
            $mh->to( $this->recipientEmail ); 
            $mh->from( $formFormEmailAddress ); 
            $mh->addParameter('formName', $this->surveyName);
            $mh->addParameter('questionSetId', $this->questionSetId);

4) Save and test :-)

See my attachment above for the whole file (taken from and directory structure to paste into your root directory.
dbrimm replied on at Permalink Reply
Hi Furehead-

I've tried downloading your file and placing it in siteroot/blocks/form with no luck... It blocks the email from being received even.

I tried the hack from the link you posted too - same thing. Unless I change the original file in which case it still comes from the Admin email and doesn't seem to change anything.

I just upgraded to Concrete

Do you have any suggestions I might try?

dbrimm replied on at Permalink Reply
shiki replied on at Permalink Reply
How did you get it to work? I have tried it at least 3 times now with no luck.
Did you modify it? I use C5
shiki replied on at Permalink Reply
Hi furehead!

I tried your solution but it didn´t work. Tried both with your attached file and to make the changes manually.

Any ideas what could be wrong?
dbrimm replied on at Permalink Reply
I couldn't get the ones posted in this thread to work. Click on the link I posted above. That is a different one I got to work. If you follow along - it will take you to a place to download the file and upload in the right spot to your website.
furehead replied on at Permalink Reply 1 Attachment
Hi Shiki and dbrimm,
I am so sorry!

I just tested my script again and recognized it didn't work for me, too! I had changed a variable name to make it more descriptive (AFTER my testing) and made a small mistake in line 401 (where I forgot to change the variable name).

I now changed $fromeEmail to $replyToMail in line 401 to fix this.

See attachment (for version

I have corrected the description and attachment in the original post above...

I am really sorry for this stupid mistake... please try again.

dbrimm replied on at Permalink Reply
Oh - thank you!
dbrimm replied on at Permalink Reply
I'm trying to get the From field to also be their email. Your latest attachment is working for the Reply To email, and I tried changing that little bit like it says above, but it blocks the email from getting through at all.

I think I'm missing something.

Thanks for your help!
furehead replied on at Permalink Reply
If you send your mails with smtp-method it might be forbidden by the mailserver to use other from-adresses.

Check your mail settings in dashboard if you use mail-function or smtp.
( /index.php/dashboard/system/mail/method/ )

This is the code (from line 401) that works with php mail function:

If it does not work check your concrete5 log which tells you whether mail has been tried to send.
dbrimm replied on at Permalink Reply
Hmm, I'm using default php method. I was using the file from the other link I posted above and it was working - only problem is it broke the responsiveness of forms.

I will try again and just to confirm, I'm changing the code above to this code, not adding this code in addition to, correct? So changing just the one word from "replyto" to "from" -- right?
furehead replied on at Permalink Reply
yes absolutely right... I have no Idea what the cause might be for your server not sending the mail. It works with my server. You might check server error log files and concrete5 protocol/log.
shiki replied on at Permalink Reply
Furehead, I finally got it to work! Thank you so much for your help!
Tekl replied on at Permalink Reply
Concrete5 5.6 seems to have changed a lot of things. Any ideas how to do it with the new version? The controller.php is nearly empty in 5.6.
sully210 replied on at Permalink Reply
I upgraded from to and this is the code in my controller.php file

defined('C5_EXECUTE') or die("Access Denied.");
class FormBlockController extends Concrete5_Controller_Block_Form {}
class FormBlockStatistics extends Concrete5_Controller_Block_FormStatistics {}
class MiniSurvey extends Concrete5_Controller_Block_FormMinisurvey {}

I am trying to change the form so I can reply to the sender, and I would like to change the "from" field to a name, not an email address, and when I do reply I would like that address to be defined somewhere as well.

sully210 replied on at Permalink Reply
Well, until we have a better solution, I am simply using an iFrame that uses a form I built at: I have an account that I pay $9.99/month for and I can design and deploy as many forms as I want. There are some drawbacks that I am working on, such as css for mobile devices and the fields shown in the reply, and the customization of the form results themselves, however, I can enter the reply to address so that when I reply to a submission, the form goes to the sender of the form. I can also customize a lot of other things you cannot easily customize with concrete5. For people who don't really code themselves, and get confused, this is an option. I hope this helps someone, and furthermore, I hope concrete5, or a developer, can create a form block that can be customized to suit everyone's needs easily without modifying code.

fridayphoto replied on at Permalink Reply
This is totally taken care of in 5.6 - this is from the Change Log :

Form Block
Email field now has ability to be set as the default reply-to so administrators can reply directly to the form submitter.

And it's true. When you're adding a new field and choose 'Email Address', there appears an option to set it as 'Reply to'. Finally!
nkennel replied on at Permalink Reply
A little note on this. I created a simple contact form but did not have this feature turned on from the start (it may have even been a sample content form that I modified instead of creating new). I recently changed the field to an "Email Address," and made it required, and checked the box that says something like, "reply to this email."

Unbeknownst to me, the box did not stay checked when I clicked save, so beware. My client informed me that reply was still going to the site admin email address. The check box continued to uncheck each time I saved changes. Eventually I recreated the field with this box checked from the start and now I believe all is well. My client has not yet replied, but the box stayed checked this time.
malkau replied on at Permalink Reply
I can confirm that this "checkbox not saving" issue is happening to me also ( -- I had thought it was me, but there seems to be other things not working like this with forms in the latest release. e.g. I could not get the redirect/thank-you page selections to save so I edited the database directly via phpmyadmin :(

@fridayphoto - that check-box is a let down, it only changes the "reply to" headers to be the sender's address, not the actual address.

This sux for me because my client uses gmail with message threading and relies on different from names/emails to differentiate the enquiries. The work-around used to work perfectly but the new release has made that fix break :(
dbrimm replied on at Permalink Reply
I remember that if you select the checkbox, it will work the first time you create it and save, but if you go in and make any changes and save again - it wouldn't and I don't know if they fixed that in the latest issue. I haven't messed with it since then.

I also had problems with the main gmail address being forwarded, but not my other gmail addresses with forwarding, when using Google Aps SMTP- google does a weird thing with Reply-to addresses.

See my post here: