<p>This is how to achieve this :</p>

<pre><code>&lt;?php

return array(
    'toEmail' =&gt; ('firstemail@domain.com,secondemail@domain.com' ?: null),
);
</code></pre>

CC BY-SA 3.0
2016-06-09T09:34:37.153Z
Well done Romain! - Please add the template tag to your answer, too
Matt P
CC BY-SA 3.0
2016-06-09T09:43:38.340Z
Thanks! There is no template tag related to recipients because they are dynamically set from the contactform.php config file.
Romain P.
CC BY-SA 3.0
2016-06-09T09:58:19.183Z
Got it. Apologies, I misunderstood.
Matt P
CC BY-SA 3.0
2016-06-09T09:15:08.887Z
2016-06-09T10:42:32.973Z
2016-06-09T10:42:32.973Z
Romain P.
<p>I don't want to show up the email recipients in the source code using this :</p>

<pre><code>&lt;input type="hidden" name="toEmail" value="{{ 'me@example.com,me2@example.com'|hash }}"&gt;
</code></pre>

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

<pre><code>&lt;?php

return array(
    'toEmail' =&gt; (hash('firstemail@domain.com, secondemail@domain.com') ?: null),
);
</code></pre>

<p>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 ?</p>

<p><strong>[UPDATE]</strong></p>

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

<pre><code>&lt;?php

return array(
    'toEmail'  =&gt; array(
        ('firstemail@domain.com' ?: null),
        ('secondemail@domain.com' ?: null)
     )
);
</code></pre>

<plugin-development><plugin-contactform>
P&T Contact Form plugin : how can I dynamically add multiple email recipients inside the form config file?
# P&T Contact Form plugin : how can I dynamically add multiple email recipients inside the form config file?

(Asked by: username_0 on 2016-06-09)

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


I want to manage multiple emails dynamically from the contactform.php config file in my craft/config folder. 
 (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 :
 array(
        ('firstemail@domain.com' ?: null),
        ('secondemail@domain.com' ?: null)
     )
);

**Tags:** plugin-development, plugin-contactform


---

## 1 answers

### Answer by username_0 on 2016-06-09. Score: 1 | Accepted answer

This is how to achieve this :
 ('firstemail@domain.com,secondemail@domain.com' ?: null),
);

> **Comments:**
> **username_1**: Well done Romain! - Please add the template tag to your answer, too  
> **username_0**: Thanks! There is no template tag related to recipients because they are dynamically set from the contactform.php config file.  
> **username_1**: Got it. Apologies, I misunderstood.  

---

