FORM_BLOCK_SENDER_EMAIL

Permalink
Hey all,

I'm trying to get the forms block to use the user's email in the From field, and I have read that using FORM_BLOCK_SENDER_EMAIL in /config/site.php should help with this.

I'm just lost as to how to actually enable it. Basically i have
define('FORM_BLOCK_SENDER_EMAIL ','');
in my site.php, but this isn't working.

Any help would be appreciated, I know its probably something simple.

Cheers.

chunksmurray
 
pvs replied on at Permalink Reply
pvs
Have you tried this:

define('FORM_BLOCK_SENDER_EMAIL ','youremail@here.com');

I am not familiar of this constant but I think you set it up like that, where did you find this constant mentioned?
Thanks
chunksmurray replied on at Permalink Reply
chunksmurray
Thanks for the reply.

I found it mentioned here:http://www.concrete5.org/community/forums/customizing_c5/forms_emai...

I was hoping to get the actual email of the person submitting the form as the from email. I could be totally wrong with my understanding of what this constant does also!
pvs replied on at Permalink Reply
pvs
i think is for the identity of the website, like the from the website email, not from the person who is sending that email.
so...

just create a dummy email called no-reply@youdomain.com
and put it in the constant
chunksmurray replied on at Permalink Reply
chunksmurray
Yeah that makes sense actually. I guess an external form would probably end up being easier for this kind of thing.

Thanks for the help.
fastcrash replied on at Permalink Reply
fastcrash
yes i have this problem too, the script go to second block, i just want to put email sender to this FORM_BLOCK_SENDER_EMAIL.
suck a pain..

this how i solve this problem open:
concrete/block/form/controller.php
i change
$mh->from( $formFormEmailAddress );

to
$mh->from( $questionAnswerPairs[3]['answer'] );


if that array not match, try print_r
echo "<pre>";
print_r($questionAnswerPairs);
echo "</pre>";



and remember, this will seting all your from block, since i just use form for 'contact page'
SVijay replied on at Permalink Reply
SVijay
Hi Guys,

If you alter the core form block, it wont work when upgraded, so it would be better to duplicate the form block and do the necessary changes that you want to do.

Many thanks
Vijay
fastcrash replied on at Permalink Reply
fastcrash
that's why i said
"and remember, this will seting all your from block, since i just use form for 'contact page'"
just move it

to /block/form
from /concrete/block/form

and why the FORM_BLOCK_SENDER_EMAIL must be the admin email, not the email that i put in block form options?
firestorm9 replied on at Permalink Reply
Here's my fix for that. Add this to the config/site.php and you can intercept all of your from emails:

# special code to intercept contact us pages and set the FROM adddress properly
if (!empty($_POST)) {
    # default to admin
    $final_email = 'no-reply@<your site here.com>';
    # if we have something in Question3 (my email is question3)
    if ($_POST['Question3']) {
        $test_email = preg_replace("/[\r\n]/", '', $_POST['Question3']);
        # check to see if it's a valid email address
        if (eregi("^['_a-z0-9-]+(\.['_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$", $test_email)) {
            # we passed the syntax check, let's check the dns records
            $host = ereg_replace(".*@", "", $test_email) . ".";
            if (getmxrr($host, $mxhosts) != false || gethostbyname($host) != $host ) {
                $final_email = $test_email;
            }
        }