 
   def deliver(%Email{} = email, config \\ []) do
     headers = prepare_headers(email, config)
-    params = email |> prepare_body |> Plug.Conn.Query.encode
     url = [base_url(config), "/", config[:domain], @api_endpoint]
 
-    case :hackney.post(url, headers, params, [:with_body]) do
+    case :hackney.post(url, headers, prepare_body(email), [:with_body]) do
       {:ok, 200, _headers, body} ->
         {:ok, %{id: Poison.decode!(body)["id"]}}
       {:ok, 401, _headers, body} ->


  defp prepare_html(body, %{html_body: nil}), do: body
  defp prepare_html(body, %{html_body: html_body}), do: Map.put(body, :html, html_body)
end

  end
  defp prepare_custom_vars(body, _email), do: body

  defp prepare_attachments(body, %{attachments: []}), do: body
  defp prepare_attachments(body, %{attachments: attachments}) do
    Map.put(body, :attachments, Enum.map(attachments, &prepare_file(&1)))
  end

  defp prepare_file(attachment) do
    {:file, attachment.path,
     {"form-data",
      [{~s/"name"/, ~s/"attachment"/},
       {~s/"filename"/, ~s/"#{attachment.filename}"/}]},
     []}
  end

  defp prepare_from(body, %Email{from: from}), do: Map.put(body, :from, prepare_recipient(from))

