Mautic and the Beauty of the Deutsche Sprache

If you’ve been sending emails forever, and happen to communicate with your clients in German, Russian (or another bunch of languages), you might need to use greeting words for your contacts based on their gender AND based on the relationship with the client. By relationship I meant – you can use a polite form in your email and a more direct voice. (Du / Sie)

I also ran into this with multiple clients, who wanted to make sure, that the newsletter doesn’t just start with ‘Hallo’, but we can actually say ‘Liebe’ or ‘Lieber’ + Firstname.

Of course you can also just save the greeting as a custom field, or create a campaign, that replaces the right greeting based on gender. But I didn’t want to use another campaign, segment or form if I can build an automation for that.

The key is to save custom field called ‘du_sie’ where we save how we would like to address the contact you communicate with.

I found the easiest way is to display the right wording is to make a gender specific rule using the free Mautic Advanced Twig Template, which enables you to create conditions, loops and other advanced content for your emails. (If you are a Mautic 3+ user keep scrolling, cause Mautic Advanced Twig Templates won’t work for you…) Here is the nested condition I came up with:

{% TWIG_BLOCK %}
  
  {% if lead.title == "Frau" %}
	{% if lead.du_sie == "Du" %}
	<p>Liebe {{lead.title}} {{lead.lastname}}</p>{% endif %}
        {% if lead.du_sie == "Sie" %}
	<p>Sehr geehrte {{lead.title}} {{lead.lastname}}</p>{% endif %}
  
  {% if lead.title == "Herr" %}
        {% if lead.du_sie == "Du" %}
        <p>Lieber {{lead.title}} {{lead.lastname}}</p>{% endif %}
	{% if lead.du_sie == "Sie" %}
        <p>Sehr geehrter {{lead.title}} {{lead.lastname}}</p>{% endif %}
  
{% END_TWIG_BLOCK %}

If you are a Mautic 3 user, you’ll need to get the Twig Templates For Mautic Plugin from the MTCextendee, and I’ll tel you it’s worth it (no, I’m not getting any commission). It will set you back by 69 EUR, one time fee.

After installation you’ll have a new menu item:

Your Twig syntax will be a bit different:

{% if contact.title %}

  {% if contact.title == "Frau" %}
	{% if contact.du_sie == "Du" %}
	<p>Liebe {{contact.title}} {{contact.lastname}}</p>{% endif %}
        {% if contact.du_sie == "Sie" %}
	<p>Sehr geehrte {{contact.title}} {{contact.lastname}}</p>{% endif %}
  {% endif %}
  
  {% if contact.title == "Herr" %}
        {% if contact.du_sie == "Du" %}
        <p>Lieber {{contact.title}} {{contact.lastname}}</p>{% endif %}
	{% if contact.du_sie == "Sie" %}
        <p>Sehr geehrter {{contact.title}} {{contact.lastname}}</p>{% endif %}
  {% endif %}

{% endif %} 

Once you installed the plugin, you can create your first TWIG block. Just copy the text above in:

Now all you have to do is to add the TWIG template’s token into your email.

If you did it well, you supposed to see something like this:

Oh man, languages are beautiful.