# Twig Templates plugin for Dear (dear name or first name) if-exist -\> and (spouse first name),

**URL:** <https://forum.mautic.org/t/twig-templates-plugin-for-dear-dear-name-or-first-name-if-exist-and-spouse-first-name/25090>\
**Category:** 3rd Party Addons\
**Created:** [August 18, 2022, 6:29pm UTC](https://forum.mautic.org/t/twig-templates-plugin-for-dear-dear-name-or-first-name-if-exist-and-spouse-first-name/25090 "2022-08-18T18:29:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![techbill](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/techbill/32/8325_2.png) [@techbill](https://forum.mautic.org/u/techbill)\
**Post date:** [August 18, 2022, 6:29pm UTC](https://forum.mautic.org/t/twig-templates-plugin-for-dear-dear-name-or-first-name-if-exist-and-spouse-first-name/25090/1 "2022-08-18T18:29:20Z")

</div>

We like including the spouse name in email to our contact out of respect when certain email intended for both so we use Twig Template and create a custom field with spouse first name.

I thought I would share on here on how we set up that it checks for “dear name” which is basically name that contact rather be called by and if dear name not exist then use first name and also check if spouse first exist then include it in the Dear (dear name/first name) and (spouse first name), at the beginning of the email.

This require purchase of Twig Template plugin which can be found over at [Twig Templates for Mautic – Mautic Extendee](https://mtcextendee.com/marketplace/twig-templates-for-mautic/)

Here the code

```auto
{% if contact.dear_name and contact.spousefirstname %}
<p>Dear {{ contact.dear_name}} and {{ contact.spousefirstname}}:</p>
{% elseif contact.firstname and contact.spousefirstname %}
<p>Dear {{ contact.firstname}} and {{ contact.spousefirstname}}:</p>
{% elseif contact.dear_name %}
<p>Dear {{ contact.dear_name}}:</p>
{% elseif contact.firstname %}
<p>Dear {{ contact.firstname}}:</p>
{% endif %}

```
