     |> encode_body()
   end
 
-  # example custom_vars
-  #
-  # %{"my_var" => %{"my_message_id": 123},
-  #   "my_other_var" => %{"my_other_id": 1, "stuff": 2}}
   defp prepare_custom_vars(body, %{provider_options: %{custom_vars: custom_vars}}) do
     Map.put(body, "h:X-Mailgun-Variables", Swoosh.json_library().encode!(custom_vars))
   end

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

  defp prepare_template(body, %{provider_options: %{template_name: template_name}}), do: Map.put(body, "template", template_name)

  defp prepare_template(body, _), do: body



  defp encode_body(no_attachments), do: Plug.Conn.Query.encode(no_attachments)

  defp encode_variable(var) when is_map(var) or is_list(var),
    do: Swoosh.json_library().encode!(var)

  defp encode_variable(var), do: var
end
