So I followed the steps here https://drupal.stackexchange.com/a/199464/49661 to configure Drupal 8 to send contact form emails via Swiftmailer.
I created a template in my theme's template directory, swiftmailer.html.twig
, which the emails do seem to be using. The issue is, I only seem to have access to all the fields at once using {{ body }}
. This just spits all the field values out in one, giant mess. Random spacing everywhere, random new lines, some fields with labels, some without.
Ideally, I'd like to be able to access individual field values so I can template it. For example:
Full Name:
{{ fields.full_name.content }}
I've tried kinting a few variables out, but all body
contains is the cluster of every field value together.
I've also tried creating more variables using [yourtheme]_swiftmailer_preprocess(&$variables)
after reading very little documenation available here https://www.drupal.org/node/1590184. This doesn't even seem to be ran when a contact form submission is made.
Here's what it looks like when I kint out body|raw
:
Thanks for any help in advance