1

I don't want to show up the email recipients in the source code using this :

<input type="hidden" name="toEmail" value="{{ '[email protected],[email protected]'|hash }}">

I want to manage multiple emails dynamically from the contactform.php config file in my craft/config folder.

<?php

return array(
    'toEmail' => (hash('[email protected], [email protected]') ?: null),
);

This config file is not working and don't override the plugin settings in the CP. What would be the best way to achieve this ?

[UPDATE]

I ended to this, but while it is working fine in the front end, this is causing PHP errors in the CP :

<?php

return array(
    'toEmail'  => array(
        ('[email protected]' ?: null),
        ('[email protected]' ?: null)
     )
);

1 Answer 1

1

This is how to achieve this :

<?php

return array(
    'toEmail' => ('[email protected],[email protected]' ?: null),
);
3
  • Well done Romain! - Please add the template tag to your answer, too
    – Matt P
    Commented Jun 9, 2016 at 9:34
  • Thanks! There is no template tag related to recipients because they are dynamically set from the contactform.php config file.
    – Romain P.
    Commented Jun 9, 2016 at 9:43
  • Got it. Apologies, I misunderstood.
    – Matt P
    Commented Jun 9, 2016 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.