     Map.put(personalizations, :dynamic_template_data, dynamic_template_data)
   end
 
-  defp prepare_dynamic_template_data(personalizations, _email), do: personalizations
-
-  defp prepare_subject(body, %{subject: subject}), do: Map.put(body, :subject, subject)
+  defp prepare_dynamic_template_data(personalizations, _email),
+    do: personalizations
+
+  defp prepare_subject(body, %{subject: subject}),
+    do: Map.put(body, :subject, subject)
 
   defp prepare_content(body, %{html_body: html, text_body: text}) do
     content =
-      cond do
-        html && text -> [%{type: "text/plain", value: text}, %{type: "text/html", value: html}]
-        html -> [%{type: "text/html", value: html}]
-        text -> [%{type: "text/plain", value: text}]
-      end
-
-    Map.put(body, :content, content)
+      Enum.reject(
+        [%{type: "text/plain", value: text}, %{type: "text/html", value: html}],
+        &is_nil(&1.value)
+      )
+
+    case content do
+      [] -> body
+      _ -> Map.put(body, :content, content)
+    end
   end
 
   defp prepare_attachments(body, %{attachments: []}), do: body


  defp prepare_asm(body, _email), do: body

  defp prepare_custom_headers(body, %{headers: headers}) when map_size(headers) == 0, do: body

  defp prepare_custom_headers(body, %{headers: headers}) do
    Map.put(body, :headers, headers)
  end

  defp prepare_mail_settings(body, %{provider_options: %{mail_settings: mail_settings}}) do
    Map.put(body, :mail_settings, mail_settings)
  end


  #
  # %{"my_var" => %{"my_message_id": 123},
  #   "my_other_var" => %{"my_other_id": 1, "stuff": 2}}
  defp prepare_custom_vars(personalizations, %{
         provider_options: %{custom_args: my_vars}
       }) do
    Map.put(personalizations, :custom_args, my_vars)
  end

