Answers.Body: <p>Looks like you've got some nested escape tags in Twig, which is a no-no.</p>
  
  <pre><code>value="{{ '{{category.contactEmail}}'|hash }}"
  </code></pre>
  
  <p>You just need to use:</p>
  
  <pre><code>value="{{ category.contactEmail|hash }}"
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-30T21:34:12.610Z
Answers.LastActivityDate: 2016-06-30T21:34:12.610Z
Answers.UserDisplayName: Brad Bell
Body: <p>Link to Github repository for plugin: <a href="https://github.com/pixelandtonic/ContactForm" rel="nofollow">https://github.com/pixelandtonic/ContactForm</a></p>
  
  <p>Being given an error by the plugin where it is interpreting my Twig variable literally as a string instead of what the variable is representing. I am looking for a way to fix this using the current set-up but having an alternate setup is fine as well. Also for reference, I have followed the guidelines on the README in regards to changing the craft/config/contactform.php file. Much appreciated for the help!</p>
  
  <p>This is my code:</p>
  
  <pre><code>{% macro errorList(errors) %}
  {% if errors %}
      &lt;ul class="errors"&gt;
          {% for error in errors %}
              &lt;li&gt;&lt;span&gt;{{ error }}&lt;/span&gt;&lt;/li&gt;
          {% endfor %}
      &lt;/ul&gt;
  {% endif %}
  {% endmacro %}
  
  {% from _self import errorList %}
  
  &lt;div class="uk-width-large-1-2 uk-width-medium-1-2 uk-width-small-1-1 uk-container-center"&gt;
  &lt;form method="post" action="" accept-charset="UTF-8"&gt;
      {{ getCsrfInput() }}
      &lt;input type="hidden" name="action" value="contactForm/sendMessage"&gt;
  
      &lt;ul id="button-content" class="uk-switcher uk-margin"&gt;
          &lt;li class="text-space basic-border"&gt;
              &lt;h3&gt;&lt;b&gt;Email to {{default.defaultcontactreason}}&lt;/b&gt;&lt;/h3&gt;
              &lt;input type="hidden" name="toEmail" value="{{ '{{default.defaultContactEmail}}'|hash }}"&gt;{{default.defaultContactEmail}}
          &lt;/li&gt;
      {% for category in craft.entries.section('Contacts') %}
          &lt;li class="text-space basic-border"&gt;
              &lt;h3&gt;&lt;b&gt;Email to {{ category.contactReason }}&lt;/b&gt;&lt;/h3&gt;
              &lt;input type="hidden" name="toEmail" value="{{ '{{category.contactEmail}}'|hash }}"&gt;{{category.contactEmail}}
          &lt;/li&gt;
      {% endfor %}
      &lt;/ul&gt;
  
      &lt;h3&gt;&lt;label for="fromName"&gt;Your Name&lt;/label&gt;&lt;/h3&gt;
      &lt;input id="fromName" type="text" name="fromName" value="{% if message is defined %}{{ message.fromName }}{% endif %}"&gt;
      {{ message is defined and message ? errorList(message.getErrors('fromName')) }}
  
      &lt;h3&gt;&lt;label for="fromEmail"&gt;Your Email&lt;/label&gt;&lt;/h3&gt;
      &lt;input id="fromEmail" type="text" name="fromEmail" value="{% if message is defined %}{{ message.fromEmail }}{% endif %}"&gt;
      {{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}
  
      &lt;h3&gt;&lt;label for="subject"&gt;Subject&lt;/label&gt;&lt;/h3&gt;
      &lt;input id="subject" type="text" name="subject" value="{% if message is defined %}{{ message.subject }}{% endif %}"&gt;
      {{ message is defined and message ? errorList(message.getErrors('subject')) }}
  
      &lt;h3&gt;&lt;label for="message"&gt;Message&lt;/label&gt;&lt;/h3&gt;
      &lt;textarea rows="10" cols="40" id="message" name="message"&gt;{% if message is defined %}{{ message.message }}{% endif %}&lt;/textarea&gt;
      {{ message is defined and message ? errorList(message.getErrors('message')) }}
  
      &lt;input type="submit" value="Send"&gt;
      &lt;input type="hidden" name="redirect" value="{{siteUrl}}Contacts"&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-06-30T20:54:37.300Z
Comments.Text: for reference, the exact exception reads: Invalid address: {{category.contactEmail}}
Comments.UserDisplayName: Matthew
Tags: <plugin-contactform>
Title: phpmailer Exception while using Pixel & Tonic contact-form plugin
ThreadText: # phpmailer Exception while using Pixel & Tonic contact-form plugin
  
  (Asked by: username_0 on 2016-06-30)
  
  Link to Github repository for plugin: <https://github.com/pixelandtonic/ContactForm>
  
  Being given an error by the plugin where it is interpreting my Twig variable literally as a string instead of what the variable is representing. I am looking for a way to fix this using the current set-up but having an alternate setup is fine as well. Also for reference, I have followed the guidelines on the README in regards to changing the craft/config/contactform.php file. Much appreciated for the help!
  
  This is my code:
  
  ```
  {% macro errorList(errors) %}
  {% if errors %}
      <ul class="errors">
          {% for error in errors %}
              <li><span>{{ error }}</span></li>
          {% endfor %}
      </ul>
  {% endif %}
  {% endmacro %}
  
  {% from _self import errorList %}
  
  <div class="uk-width-large-1-2 uk-width-medium-1-2 uk-width-small-1-1 uk-container-center">
  <form method="post" action="" accept-charset="UTF-8">
      {{ getCsrfInput() }}
      <input type="hidden" name="action" value="contactForm/sendMessage">
  
      <ul id="button-content" class="uk-switcher uk-margin">
          <li class="text-space basic-border">
              <h3><b>Email to {{default.defaultcontactreason}}</b></h3>
              <input type="hidden" name="toEmail" value="{{ '{{default.defaultContactEmail}}'|hash }}">{{default.defaultContactEmail}}
          </li>
      {% for category in craft.entries.section('Contacts') %}
          <li class="text-space basic-border">
              <h3><b>Email to {{ category.contactReason }}</b></h3>
              <input type="hidden" name="toEmail" value="{{ '{{category.contactEmail}}'|hash }}">{{category.contactEmail}}
          </li>
      {% endfor %}
      </ul>
  
      <h3><label for="fromName">Your Name</label></h3>
      <input id="fromName" type="text" name="fromName" value="{% if message is defined %}{{ message.fromName }}{% endif %}">
      {{ message is defined and message ? errorList(message.getErrors('fromName')) }}
  
      <h3><label for="fromEmail">Your Email</label></h3>
      <input id="fromEmail" type="text" name="fromEmail" value="{% if message is defined %}{{ message.fromEmail }}{% endif %}">
      {{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}
  
      <h3><label for="subject">Subject</label></h3>
      <input id="subject" type="text" name="subject" value="{% if message is defined %}{{ message.subject }}{% endif %}">
      {{ message is defined and message ? errorList(message.getErrors('subject')) }}
  
      <h3><label for="message">Message</label></h3>
      <textarea rows="10" cols="40" id="message" name="message">{% if message is defined %}{{ message.message }}{% endif %}</textarea>
      {{ message is defined and message ? errorList(message.getErrors('message')) }}
  
      <input type="submit" value="Send">
      <input type="hidden" name="redirect" value="{{siteUrl}}Contacts">
  </form>
  </div>
  
  ```
  
  **Tags:** plugin-contactform
  
  > **Comments:**
  > **username_0**: for reference, the exact exception reads: Invalid address: {{category.contactEmail}}  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-06-30. Score: 1 | Accepted answer
  
  Looks like you've got some nested escape tags in Twig, which is a no-no.
  
  ```
  value="{{ '{{category.contactEmail}}'|hash }}"
  
  ```
  
  You just need to use:
  
  ```
  value="{{ category.contactEmail|hash }}"
  
  ```
  
  
  ---
  
  