1

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

<input type="hidden" name="toEmail" value="{{ 'me@example.com,me2@example.com'|hash }}">

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

<?php

return array(
    'toEmail' => (hash('firstemail@domain.com, secondemail@domain.com') ?: 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(
        ('firstemail@domain.com' ?: null),
        ('secondemail@domain.com' ?: null)
     )
);
1

This is how to achieve this :

<?php

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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