title: Mandrill Email sending error : Please enter an array
body: <h1>Mandrill</h1>
  <p>I am using RestSharp for making an API call to the Mandrill for sending emails.</p>
  <pre><code>public List&lt;EmailResult&gt; SendMessageTemplate(MandrillApi mapiResponse, string templateName, EmailMessage emailMessage)
      {
          //if (mapiResponse != null &amp;&amp; !string.IsNullOrEmpty(mapiResponse.ApiKey) &amp;&amp; !string.IsNullOrEmpty(mapiResponse.BaseUrl)
          //                         &amp;&amp; !string.IsNullOrEmpty(templateName) &amp;&amp; templateContent != null &amp;&amp; templateContent.Count &gt; 0 &amp;&amp; emailMessage != null)
          if (mapiResponse != null &amp;&amp; !string.IsNullOrEmpty(mapiResponse.ApiKey) &amp;&amp; !string.IsNullOrEmpty(mapiResponse.BaseUrl)
                                   &amp;&amp; !string.IsNullOrEmpty(templateName) &amp;&amp; emailMessage != null)
          {
  
              List&lt;EmailResult&gt; emailResult = new List&lt;EmailResult&gt;();
  
              var soEmailMessage = JsonConvert.SerializeObject(emailMessage);
              restRequest = new RestSharp.RestRequest
              {
                  RequestFormat = DataFormat.Json,
                  Method = RestSharp.Method.POST,
                  //Resource = string.Format(&quot;{0}/send-template.json&quot;, &quot;messages&quot;)
                  Resource = string.Format(&quot;{0}/send.json&quot;, &quot;messages&quot;)
              };
              restRequest.AddBody(new { key = mapiResponse.ApiKey, template_name = templateName, message = soEmailMessage });
  
              restClient = new RestSharp.RestClient(mapiResponse.BaseUrl);
              var response = restClient.Execute(restRequest);
  
              emailResult = JsonConvert.DeserializeObject&lt;List&lt;EmailResult&gt;&gt;(response.Content);
  
              return emailResult;
          }
  
          else
              return null;
      }
  </code></pre>
  <p>However I get the response as</p>
  <blockquote>
  <p>&quot;Please enter an array&quot;.</p>
  <pre><code> {&quot;status&quot;:&quot;error&quot;,&quot;code&quot;:-2,&quot;name&quot;:&quot;ValidationError&quot;,&quot;message&quot;:&quot;Validation error: {\&quot;message\&quot;:\&quot;Please enter an array\&quot;}&quot;}
  </code></pre>
  </blockquote>
  <p>The JSON generated after serialization is as follows:</p>
  <pre><code>&quot;message&quot;: {
  &quot;attachments&quot;: [],
  &quot;auto_html&quot;: null,
  &quot;auto_text&quot;: true,
  &quot;bcc_address&quot;: null,
  &quot;from_email&quot;: &quot;test@gmail.com&quot;,
  &quot;from_name&quot;: &quot;ABC&quot;,
  &quot;global_merge_vars&quot;: [{
      &quot;content&quot;: &quot;test&quot;,
      &quot;name&quot;: &quot;ffname&quot;
  }],
  &quot;google_analytics_campaign&quot;: null,
  &quot;google_analytics_domains&quot;: null,
  &quot;headers&quot;: null,
  &quot;html&quot;: null,
  &quot;images&quot;: null,
  &quot;important&quot;: null,
  &quot;inline_css&quot;: null,
  &quot;merge&quot;: null,
  &quot;merge_vars&quot;: null,
  &quot;metadata&quot;: null,
  &quot;preserve_recipients&quot;: false,
  &quot;raw_message&quot;: null,
  &quot;raw_to&quot;: null,
  &quot;recipient_metadata&quot;: null,
  &quot;return_path_domain&quot;: null,
  &quot;signing_domain&quot;: null,
  &quot;subaccount&quot;: null,
  &quot;subject&quot;: &quot;Test&quot;,
  &quot;merge_language&quot;: null,
  &quot;tags&quot;: [&quot;Sep-2019&quot;],
  &quot;text&quot;: null,
  &quot;to&quot;: [{
      &quot;email&quot;: &quot;shubhamtest@gmail.com&quot;,
      &quot;name&quot;: &quot;Test Email Address&quot;,
      &quot;type&quot;: null
  }],
  &quot;track_clicks&quot;: true,
  &quot;track_opens&quot;: true,
  &quot;tracking_domain&quot;: null,
  &quot;url_strip_qs&quot;: null,
  &quot;view_content_link&quot;: null }
  </code></pre>
  <p>The EmailMessage class is part of the Mandrill assembly and it contains:</p>
  <p><a href="https://i.stack.imgur.com/btdxp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/btdxp.png" alt="enter image description here" /></a></p>
  <p>Mandrill Assembly: I installed it via NugetPackage. Please find the below link:</p>
  <p><a href="https://www.nuget.org/packages/Mandrill/" rel="nofollow noreferrer">https://www.nuget.org/packages/Mandrill/</a></p>
  <p>I tried few solutions like adding the emailmessage object into a list and then converting it into an array. But it gives the response as <code>&quot;[]&quot;</code>.</p>
  <p>Can anyone please suggest for the same?</p>
  <p>Thanks</p>