craftcms/contact-form

Dynamically adding email recipients will be ignored

miro94 opened this issue · 8 comments

If I define a recipient in the form (through hidden input field) like in the documentation, the notification mail will not be sent to this mail address (only to the regular mail address defined in the plugin settings)
<input type="hidden" name="toEmail" value="{{ 'me@example.com'|hash }}">

In the XHR Call, the defined email address (toEmail) is visible and the call is successful (200).
call

Is this function implemented?
Thanks.

I second this. Seems to completely ignore the toEmail value even with the correct logic in contactform.php

same issue

Have you made the change to config/contact-form.php shown here? https://github.com/craftcms/contact-form#dynamically-adding-email-recipients

@jonathanmelville are you using contactform.php or contact-form.php? It should be the latter.

Have you made the change to config/contact-form.php shown here? https://github.com/craftcms/contact-form#dynamically-adding-email-recipients

it helps thank you!

@angrybrad @brandonkelly I should have mentioned this is using the v1 branch on an older Craft 2.9.1 site. I'm using a file called contactform.php per the instructions on that branch and have the correct hidden input in my form and my config file looks like this:

<?php
namespace Craft;

$toEmail = craft()->request->getPost('toEmail');
$toEmail = craft()->security->validateData($toEmail);
return array(
    'toEmail' => ($toEmail ?: null),
);

Using these settings it still only sends to the email in the plugin settings from the control panel.

@jonathanmelville huh... any chance you can reproduce that locally on a box with xDebug installed to step through and see what's going on?

Closing this out due to age (and on a Craft 2 site).