craftcms / contact-form

Add a simple contact form to your Craft CMS site.
https://plugins.craftcms.com/contact-form
MIT License
294 stars 93 forks source link

Dynamically adding email recipients will be ignored #187

Closed miro94 closed 1 year ago

miro94 commented 4 years ago

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.

jonathanmelville commented 4 years ago

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

Bronskiy commented 4 years ago

same issue

brandonkelly commented 4 years ago

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

angrybrad commented 4 years ago

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

Bronskiy commented 4 years ago

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!

jonathanmelville commented 4 years ago

@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.

angrybrad commented 4 years ago

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

tommysvr commented 1 year ago

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