Language specific emails to user by country in MailChimp or Mandril
  • 03 Sep 2019
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

Language specific emails to user by country in MailChimp or Mandril

  • Dark
    Light
  • PDF

Article summary

To send users different email based on language

  1. Code the email template with conditions around variable "subscription.countrycode" and send separate lannguage emails based on the country user came from. Example code to this folows
{{#if `subscription.countrycode == "DK"`}}
    <h1 style="color: #222222; font-family: 'Helvetica', 'Arial', sans-serif; font-weight: normal; text-align: left; line-height: 1.3; word-break: normal; font-size: 24px; margin: 0; padding: 20px 0 0;" align="left">SE ALT DET DU VIL.<br/>YOUR TITLE</h1>    
    <p>Hej{{#if `user.name == "null"`}}{{elseif `user.name == ""`}}{{else}} {{user.name}}{{/if}},</p>
    <p> YOUR MESSAGE </p>
{{elseif `subscription.countrycode == "DE"`}}
    <h1 style="color: #222222; font-family: 'Helvetica', 'Arial', sans-serif; font-weight: normal; text-align: left; line-height: 1.3; word-break: normal; font-size: 24px; margin: 0; padding: 20px 0 0;" align="left">YOUR TITLE </h1>    
    <p>Hallo{{#if `user.name == "null"`}}{{elseif `user.name == ""`}}{{else}} {{user.name}}{{/if}},</p>
    <p>YOUR MESSAGE </p>
{{else}}
    <h1 style="color: #222222; font-family: 'Helvetica', 'Arial', sans-serif; font-weight: normal; text-align: left; line-height: 1.3; word-break: normal; font-size: 24px; margin: 0; padding: 20px 0 0;" align="left">YOUR HEADING</h1>    
    <p>Hello{{#if `user.name == "null"`}}{{elseif `user.name == ""`}}{{else}} {{user.name}}{{/if}},</p>
    <p>YOUR MESSAGE</p>

{{/if}}

Was this article helpful?