Assistance with Form on version 5.7.5.13

Permalink
Hi All,

I have a client who is driving me nuts with the form structure. I have looked at the forums and have implemented a few changes to the form controller.php. Presently it looks like this:

$mh = Core::make('helper/mail');
$mh->to($this->recipientEmail);
$mh->from($formFormEmailAddress);
$mh->replyto($replyToEmailAddress);
$mh->addParameter('formName', $this->surveyName);
$mh->addParameter('questionSetId', $this->questionSetId);
$mh->addParameter('questionAnswerPairs', $questionAnswerPairs);
$mh->load('block_form_submission');
$mh->setSubject(t('[Email: %s] %s Form Submission', $replyToEmailAddress, $this->surveyName));
//echo $mh->body.'<br>';
@$mh->sendMail();

Here is where I am now. When a form is submitted, it now comes from her email address instead of admin. That part is ok. The part she is requesting is when she receives the form submission that she can click reply and it replies to the submitters email address. Presently, it shows her email address and she ends up sending the reply to herself. I am using the typical 5.7 form.



I have hit the wall and cannot get it to work. Anyone interested, please just reply and I will get back to you asap.

Thanks

surfsupjoe125
View Replies: View Best Answer
Steevb replied on at Permalink Reply
Steevb
Have you tried ticking the 'Reply to this email address' box?
surfsupjoe125 replied on at Permalink Reply
surfsupjoe125
Yes, that makes the reply land in her email. The problem is when she looks
at the form that was submitted, she wants to be able to reply back to the
submitter but it does not pickup the submitters email address. Instead it
picks up her email causing the email to be sent to herself.

I hope this makes sense

Thanks


*Joe Notarianni*
Tel:(239) 434-7095
Cell:(239) 298-3984
mnakalay replied on at Permalink Reply
mnakalay
There are ways to do that but they are all hacky.

The only way you have to have the sender's email is to make sure you add an email field for them to provide an email.

Having done that, as far as the form block is concerned, that's just another field in your form that happens to be an email field.

You would have to modify the code to use the value from that field and specifically set it as the "from" email address

When you look at fields through code you can check the field type and if it's email then (assuming you only have one email field) use that value
Steevb replied on at Permalink Reply 2 Attachments
Steevb
This is what I see without messing with code, am I missing something?

See attached.
mhawke replied on at Permalink Reply 1 Attachment
mhawke
Mine works as intended as well. Surfupjoe125, are you sure you have the right box checked? It's a box on the email field itself.

See attached.
surfsupjoe125 replied on at Permalink Reply
surfsupjoe125
Thanks again for your reply. There are two issues. First was that she did
not want the from [email protected] to display. I used a recommendation from the
forum to handle that issue. so now it states from [email protected]

The second issue is that when the form arrives as email, it is from
[email protected], so when she replies it replies to herself. Make
sense??




*Joe Notarianni*
Tel:(239) 434-7095
Cell:(239) 298-3984
mnakalay replied on at Permalink Reply
mnakalay
Yes that is correct.

I am wondering if maybe the problem is not at the email provider's level.

I know that some email providers (gmail used to do it) will not take into account the from field under certain circumstances (which I can't remember)

I used to have this problem on my website, I always ended up having emails have the proper from email but when I would click on "answer" it would then use my email instead. I read something at the time about some security issue.

Then one day it just started working normally...

Maybe that's the issue
surfsupjoe125 replied on at Permalink Reply
surfsupjoe125
Hi Steev,

I guess I am not explaining myself clearly. The first issue was she did not
want the email to be sent from admin. I amended the code line 570 so that
the form that was sent originated from her email address. So far so good.

Now, since the email originates as a form sent from her email address, it
arrives with the from "as her email address" making the reply go back to
her instead of the submitters email address that was placed in the form
question asking for their email.

Hoepfully, this makes more sense

Thanks so much for putting up with my frustration.


*Joe Notarianni*
Tel:(239) 434-7095
Cell:(239) 298-3984
blueatlas replied on at Permalink Reply
blueatlas
Based on what mnakalay describes above, the following should work for you. Change "Your Form Name" to the name of your form, and change "E-mail address" to name of the e-mail address field on the form.

After line #548, add the following:

$emailAddress = "";
if ($this->surveyName == "Your Form Name") {
if ($questionAnswerPair['question'] == "E-mail address") {
$emailAddress = $questionAnswerPair['answer'];
}
}

Then on line #571 replace:

$mh->replyto($replyToEmailAddress);

with:

$mh->replyto($emailAddress);

Dave
surfsupjoe125 replied on at Permalink Reply
surfsupjoe125
Thanks so much!! I will give this a try.


*Joe Notarianni*
Tel:(239) 434-7095
Cell:(239) 298-3984
Steevb replied on at Permalink Reply 1 Attachment
Steevb
Sorry, still confused.

My form does not come from admin, it come from whatever email address I want, see attached?
surfsupjoe125 replied on at Permalink Reply
surfsupjoe125
Hi Steev,

I am sorry, lol. I have her email address in the same box you showed me.
Unfortunately the form does not come from the submitters email. It comes
from an administrator.




*Joe Notarianni*
Tel:(239) 434-7095
Cell:(239) 298-3984
mhawke replied on at Permalink Reply
mhawke
Are you sure your coding to 'fix' the "From" address isn't messing up the default behaviour?

I don't want to sound simplistic but this is how I set up a form to do precisely what you want to have happen.

http://screencast-o-matic.com/watch/cbnYFL6ouY...
blueatlas replied on at Permalink Reply
blueatlas
This seems like the right approach. I didn't know you could set an e-mail address form field to be used for the reply-to. Ignore my hacky code above.
surfsupjoe125 replied on at Permalink Reply
surfsupjoe125
Hi Michael,

Could it be the form in the theme is bad?? I don't see the confirmation option like you have. I have setup soooo many forms but never had this problem.

For some reason, it picks up the admin email as the sent from, you see the form that was submitted in your email, but if you click reply obviously it sends to the from email ( this is the admin email) which is driving her nuts.

Thanks
mhawke replied on at Permalink Reply
mhawke
Sorry, disregard the 'Confirmation' tab. That's a custom addition.
surfsupjoe125 replied on at Permalink Reply
surfsupjoe125
So... when you receive a form from your site, it displays the from as the
submitter's email address? for me it always shows the admin account as the
sender. This obviously makes an replies go back to the admin email.

Am I missing soemthing?? This is driving me nuys, lol


*Joe Notarianni*
Tel:(239) 434-7095
Cell:(239) 298-3984
mhawke replied on at Permalink Reply
mhawke
No, when the site owner receives an email that's sent from a form on the website, it is from the address you put in the 'Options' tab (and checked the box beside it). IF you check the box "Reply to this address" box on the actual email question on the form itself, then when the site owner clicks Reply To then this reply goes back to whoever filled in the form.
surfsupjoe125 replied on at Permalink Reply
surfsupjoe125
Thanks Michael,

I don't have that option in the form. I only have below:

Notify me by email when people submit this form
(Seperate multiple emails with a comma)
Could this form be replaced with something that has that option?


*Joe Notarianni*
Tel:(239) 434-7095
Cell:(239) 298-3984
mhawke replied on at Permalink Reply
mhawke
If you go to the Edit tab and click the pencil icon to edit the email question, does the "Reply to this email address" option show up?

http://screencast-o-matic.com/watch/cbnYqK6owE...
surfsupjoe125 replied on at Permalink Reply
surfsupjoe125
No sir it does not


*Joe Notarianni*
Tel:(239) 434-7095
Cell:(239) 298-3984
Steevb replied on at Permalink Reply
Steevb
Think you need to go back and start again.

Remove all mods from controller and try placing a fresh form on page somewhere.
surfsupjoe125 replied on at Permalink Reply
surfsupjoe125
I did that already. I removed all edits and placed it back to original. I
also loaded a new form block. Still no reply to this email option???

I'm stumped.


*Joe Notarianni*
Tel:(239) 434-7095
Cell:(239) 298-3984
mhawke replied on at Permalink Best Answer Reply
mhawke
Is it possible that some CSS rule is hiding it? Can you check the HTML of the form to see if the option is actually in the HTML? (grasping at straws)
surfsupjoe125 replied on at Permalink Reply
surfsupjoe125
I really appreciate your time with me. I will take a look and see if I can
see anything

Thanks again


*Joe Notarianni*
Tel:(239) 434-7095
Cell:(239) 298-3984
mhawke replied on at Permalink Reply
mhawke
Just to confirm that the "Reply to this email address" is on Lines 177 and 265 of root/concrete/blocks/form/form_setup_html.php.

I have mine over-ridden by placing the modified version in root/application/blocks/form/form_setup_html.php
surfsupjoe125 replied on at Permalink Reply
surfsupjoe125
I am good to go Michael. Marked you as best answer. I really do appreciate
your support. This was driving me crazy!! Short trip but I am back now, lol

Thanks again


*Joe Notarianni*
Tel:(239) 434-7095
Cell:(239) 298-3984
mhawke replied on at Permalink Reply
mhawke
Was it actually CSS related?
surfsupjoe125 replied on at Permalink Reply
surfsupjoe125
You know I am not sure. I just had to delete everything a build a new form
for the 4th or 5 th time and finally that option became available. I wih I
knew the specific problem but I am just happy it is working as she
requested.

Cheers and thanks


*Joe Notarianni*
Tel:(239) 434-7095
Cell:(239) 298-3984
mhawke replied on at Permalink Reply
mhawke
Glad it's working but don't mark my answer as a solution if it wasn't the solution. Steevb's suggestion to back out your code changes is probably closer to the real solution.