Answers.Body: <p>There's no way to do this by default as far as I know so you'd need to create a small plugin to <a href="https://github.com/pixelandtonic/ContactForm#dynamically-adding-email-recipients-requires-craft-25" rel="nofollow noreferrer">dynamically add the recipient email</a> to the form. </p>
  
  <p>You might be able to shortcut that a little by changing that hidden input value using JavaScript alone depending on what was selected in the dropdown but the <code>toEmail</code> param is <em>meant</em> to be hashed. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-20T15:24:24.260Z
Answers.LastActivityDate: 2017-02-20T15:24:24.260Z
Answers.UserDisplayName: Ian Young
Answers.Body: <p>First create a new config file in your craft > config folder and name it <code>contactform.php</code>. This is a config for the Contact Form plugin.  Next add this bit of code to it. </p>
  
  <pre><code>&lt;?php
  namespace Craft;
  
  $toEmail = craft()-&gt;request-&gt;getPost('toEmail');
  $toEmail = craft()-&gt;security-&gt;validateData($toEmail);
  
  return array(
      'toEmail' =&gt; ($toEmail ?: null),
  );
  </code></pre>
  
  <p>In your html create a SELECT input and give it the name <code>name=toEmail</code>. You could create a dynamic list with a table input.  Make sure to use the <code>hash</code> filter when outputting your email address into value.</p>
  
  <pre><code>&lt;select name="toEmail"&gt;
      {# emailList is handle of custom table input. #}
     {% for item in entry.emailList %}
          {# email &amp; subject are custom table input column handles #}
         &lt;option value="{{ item.email|hash }}"&gt;{{ item.subject }}&lt;/option&gt;
     {% endfor %}
  &lt;/select&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-20T21:02:20.783Z
Answers.Text: Thank you. Do I miss something obvious? As I'm getting Getting `Variable "entry" does not exist` for `{% for item in entry.emailList %}`. Sorry for noob question. I tried to set by `{% set entry = craft.entries.id(5) %}` but doesn't seem to work, getting in result a plain drop-down.
Answers.UserDisplayName: curious
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-20T21:05:09.333Z
Answers.Text: No problem entry is the default variable provided by Craft when you are visiting an entries url.  Use whatever variable  to access the custom table you created. Change your set entry to something else. ```{% set pageVar = craft.entries.id(5) %}``` then ``` {% for item in pageVar.emailList %}``` assuming emailList is the handle you set for your custom table input.
Answers.UserDisplayName: a-am
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-02-20T16:05:16.143Z
Answers.LastActivityDate: 2017-02-20T16:05:16.143Z
Answers.UserDisplayName: a-am
Body: <p>There is a guide on GitHub page how to add additional fields, but how to add recipient selection?</p>
  
Tags: <plugin-contactform>
Title: How to add recipient drop-down selection field with the Contact Form plugin?
ThreadText: # How to add recipient drop-down selection field with the Contact Form plugin?
  
  (Asked by: username_0 on 2017-02-20)
  
  There is a guide on GitHub page how to add additional fields, but how to add recipient selection?
  
  **Tags:** plugin-contactform
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2017-02-20. Score: 1
  
  There's no way to do this by default as far as I know so you'd need to create a small plugin to [dynamically add the recipient email](https://github.com/pixelandtonic/ContactForm#dynamically-adding-email-recipients-requires-craft-25) to the form.
  
  You might be able to shortcut that a little by changing that hidden input value using JavaScript alone depending on what was selected in the dropdown but the `toEmail` param is *meant* to be hashed.
  
  
  ---
  
  ### Answer by username_2 on 2017-02-20. Score: 1
  
  First create a new config file in your craft > config folder and name it `contactform.php`. This is a config for the Contact Form plugin. Next add this bit of code to it.
  
  ```
  <?php
  namespace Craft;
  
  $toEmail = craft()->request->getPost('toEmail');
  $toEmail = craft()->security->validateData($toEmail);
  
  return array(
      'toEmail' => ($toEmail ?: null),
  );
  
  ```
  
  In your html create a SELECT input and give it the name `name=toEmail`. You could create a dynamic list with a table input. Make sure to use the `hash` filter when outputting your email address into value.
  
  ```
  <select name="toEmail">
      {# emailList is handle of custom table input. #}
     {% for item in entry.emailList %}
          {# email & subject are custom table input column handles #}
         <option value="{{ item.email|hash }}">{{ item.subject }}</option>
     {% endfor %}
  </select>
  
  ```
  
  > **Comments:**
  > **username_0**: Thank you. Do I miss something obvious? As I'm getting Getting `Variable "entry" does not exist` for `{% for item in entry.emailList %}`. Sorry for noob question. I tried to set by `{% set entry = craft.entries.id(5) %}` but doesn't seem to work, getting in result a plain drop-down.  
  > **username_2**: No problem entry is the default variable provided by Craft when you are visiting an entries url.  Use whatever variable  to access the custom table you created. Change your set entry to something else. ```{% set pageVar = craft.entries.id(5) %}``` then ``` {% for item in pageVar.emailList %}``` assuming emailList is the handle you set for your custom table input.  
  
  ---
  
  