Composing an HTML email body in PHP swiftmailer
As you're using the Twig template engine already, I would recommend to use it for your email-templates as well. It will have all the advantages like:


easy to maintain
easy to localize
template and its content is separated from your logic
all templates are in one place


Symfony has a manual, how to use Twig together with Swiftmailer. This will work also without the Symfony framework.

In your case you can simply store the rendered template in $message and pass it on to Mail::send():

$message = $twig-&gt;renderView(
    'resources/views/emails/password_reset.html.twig', [
    'first_name' =&gt; $user["first_name"],
    'reset_link' =&gt; $resetLink,
]);


In your template you have all the advantages and simplicity of Twig:

Hello {{ first_name }},

&lt;a href="{{ reset_link }}"&gt;Please click here to reset your password&lt;/a&gt;




You could take it one step further and include the subject as well in the template:

{% if true == get_subject %}
    {% spaceless %}
        Password reset link
    {% endspaceless %}
{% else %}
    Hello {{ first_name }}
{% endif %}


You need spaceless in this case for the subject, so that Twig will remove all whitespaces, tabs etc. before and after the subject.