{"id":14824,"date":"2020-12-14T07:21:55","date_gmt":"2020-12-14T07:21:55","guid":{"rendered":"https:\/\/www.gmass.co\/blog\/?p=14824"},"modified":"2026-05-26T18:29:44","modified_gmt":"2026-05-26T18:29:44","slug":"conditional-content","status":"publish","type":"post","link":"https:\/\/www.gmass.co\/blog\/conditional-content\/","title":{"rendered":"Conditional Content in Email Campaigns (Using If&#8230;Then for Precise Personalization)"},"content":{"rendered":"<p>It&#8217;s important to personalize your emails. Now you can <strong>hyper-personalize your outreach emails<\/strong> with conditional content using simple <strong>If\/Then<\/strong> statements in the <strong>Subject<\/strong> and <strong>Body<\/strong> of your message. Do you have to be a programmer to do this? No! We make inserting conditional content fairly easy. Use one of our <strong>copy\/paste recipes<\/strong> and modify to your tastes. Let&#8217;s get started.<\/p>\n<h2>How do you use conditional content?<\/h2>\n<figure id=\"attachment_14876\" aria-describedby=\"caption-attachment-14876\" style=\"width: 1032px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/Conditional-Content-Animation-v2.gif\" data-rel=\"lightbox-image-0\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-14876\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/Conditional-Content-Animation-v2.gif\" alt=\"\" width=\"1032\" height=\"1045\" \/><\/a><figcaption id=\"caption-attachment-14876\" class=\"wp-caption-text\">Just type two left curly brackets for the conditional code menu to appear.<\/figcaption><\/figure>\n<p>Conditional content blocks can be placed in the <strong>Subject<\/strong> and <strong>Message<\/strong> inside a set of double curly brackets, like so:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{{...code...}}\r\n<\/pre>\n<p>You can mix regular merge tags, which use a single set of curly brackets, with conditional code blocks, so:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nHi {FirstName},\r\n\r\n{{...code...}}\r\n<\/pre>\n<p>In the Gmail <strong>Compose<\/strong> box&#8217;s <strong>Subject<\/strong> and <strong>Message<\/strong> areas, just type a single left curly bracket to see the regular merge tag menu and type <strong>two left curly brackets<\/strong> to see the conditional content menu. The conditional content menu gives you sample shorthand <strong>If\/Then<\/strong> statements for each variable in your campaign. Of course you&#8217;ll want to customize the statement from there.<\/p>\n<p><a href=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-content-example-web.png\" data-rel=\"lightbox-image-1\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-15532 size-full\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-content-example-web.png\" alt=\"\" width=\"1192\" height=\"854\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-content-example-web.png 1192w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-content-example-web-300x215.png 300w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-content-example-web-1024x734.png 1024w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-content-example-web-768x550.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-content-example-web-24x17.png 24w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-content-example-web-36x26.png 36w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-content-example-web-48x34.png 48w\" sizes=\"auto, (max-width: 1192px) 100vw, 1192px\" \/><\/a><\/p>\n<h2>What statements can you use?<\/h2>\n<p>Let&#8217;s say you have a column in your <strong>Google Sheet<\/strong> called <strong>Industry<\/strong> that identifies the industry that each of your email prospects works in.<\/p>\n<p><a href=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/002-mailing-list-407kb.png\" data-rel=\"lightbox-image-2\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14847 size-full\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/002-mailing-list-407kb.png\" alt=\"mailing list\" width=\"1789\" height=\"1980\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/002-mailing-list-407kb.png 1789w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/002-mailing-list-407kb-271x300.png 271w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/002-mailing-list-407kb-768x850.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/002-mailing-list-407kb-925x1024.png 925w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/002-mailing-list-407kb-22x24.png 22w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/002-mailing-list-407kb-33x36.png 33w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/002-mailing-list-407kb-43x48.png 43w\" sizes=\"auto, (max-width: 1789px) 100vw, 1789px\" \/><\/a><\/p>\n<p>Our conditional content feature supports a bunch of statements, but the most useful will be the <strong>If\/Then<\/strong> statement. Here&#8217;s an example.<\/p>\n<p><strong>Basic If\/Then statement:<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{{If Industry=&quot;Recruiting&quot; Then}}\r\n\r\n{FirstName}, hope the recruiting business is going well and you're placing lots of candidates!\r\n\r\n{{End If}}\r\n\r\n{{If Industry=&quot;Sales&quot; Then}}\r\n\r\n{FirstName}, hope your sales are high and you're closing deals left and right!\r\n\r\n{{End If}}\r\n\r\n{{If Industry=&quot;Other&quot; Then}}\r\n\r\n{FirstName}, hope things are going well for you.\r\n\r\n{{End If}}\r\n<\/pre>\n<p><strong>Basic If\/Then\/Else:<\/strong><\/p>\n<p>A better way to do the above is to use an <strong>ELSE<\/strong> block.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{{If Industry=&quot;Recruiting&quot; Then}}\r\n\r\n{FirstName}, hope the recruiting business is going well and you're placing lots of candidates!\r\n\r\n{{Else If Industry=&quot;Other&quot; Then}}\r\n\r\n{FirstName}, hope your sales are high and you're closing deals left and right!\r\n\r\n{{Else}}\r\n\r\n{FirstName}, hope things are going well for you.\r\n\r\n{{End If}}\r\n<\/pre>\n<p>In the above examples, I&#8217;m outputting text to my email based on the Industry column of my spreadsheet. Additionally, I&#8217;m using a regular &#8220;FirstName&#8221; merge tag in each of the code blocks.<\/p>\n<p><strong>Using comparative operators<\/strong><\/p>\n<p>If your <strong>Google Sheet<\/strong> has columns with <strong>numerical<\/strong> data, then you can use those to set content based on conditions. For example if your <strong>CRM<\/strong> system has a field called <strong>DaysSinceLastContact<\/strong> and you export from your CRM system to a Google Sheet, you might do this:<\/p>\n<p><a href=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/003-example-of-comparative-operator-368kb.png\" data-rel=\"lightbox-image-3\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14848 size-full\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/003-example-of-comparative-operator-368kb.png\" alt=\"example of comparative operator\" width=\"1500\" height=\"1776\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/003-example-of-comparative-operator-368kb.png 1500w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/003-example-of-comparative-operator-368kb-253x300.png 253w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/003-example-of-comparative-operator-368kb-768x909.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/003-example-of-comparative-operator-368kb-865x1024.png 865w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/003-example-of-comparative-operator-368kb-20x24.png 20w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/003-example-of-comparative-operator-368kb-30x36.png 30w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/003-example-of-comparative-operator-368kb-41x48.png 41w\" sizes=\"auto, (max-width: 1500px) 100vw, 1500px\" \/><\/a><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{{If CInt(DaysSinceLastContact) &gt; 30 Then}}\r\n\r\nIt's been a long while...{DaysSinceLastContact} days since we talked!\r\n\r\n{{Else}}\r\n\r\nHope I'm not annoying you with all my outreach!\r\n\r\n{{End If}}\r\n<\/pre>\n<p>In the above example, it&#8217;s important to surround <strong>DaysSinceLastContact<\/strong> with the <strong>CInt<\/strong> command, which converts the column to an integer type, so that it can be properly compared to the integer 30. Without <strong>CInt<\/strong>, it would be compared as a string, and would yield different results.<\/p>\n<p>Let&#8217;s say you have a column called <strong id=\"dates\">LastPurchaseDate<\/strong> where you track the last time a customer purchased from you. You might want to vary some text based on <strong>how long ago your customer last purchased<\/strong>.<\/p>\n<p><a href=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/004-condition-last-purchase-date-554kb.png\" data-rel=\"lightbox-image-4\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14850 size-full\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/004-condition-last-purchase-date-554kb.png\" alt=\"condition - last purchase date\" width=\"1386\" height=\"1708\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/004-condition-last-purchase-date-554kb.png 1386w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/004-condition-last-purchase-date-554kb-243x300.png 243w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/004-condition-last-purchase-date-554kb-768x946.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/004-condition-last-purchase-date-554kb-831x1024.png 831w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/004-condition-last-purchase-date-554kb-19x24.png 19w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/004-condition-last-purchase-date-554kb-29x36.png 29w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/004-condition-last-purchase-date-554kb-39x48.png 39w\" sizes=\"auto, (max-width: 1386px) 100vw, 1386px\" \/><\/a><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{{If CDate(LastPurchaseDate) &gt; CDate(&quot;1\/1\/26&quot;) Then}}\r\n\r\nThanks for supporting us with a purchase this year. You last purchased on {LastPurchaseDate}.\r\n\r\n{{Else}}\r\n\r\nIt's been a while since we've heard from you. Can we help you with your next purchase?\r\n\r\n{{End If}}\r\n<\/pre>\n<p>Note the use of the <strong>CDate<\/strong> operator. That makes sure that both values are <strong>treated as dates and compared as dates<\/strong>. If you&#8217;re a programmer, just like with integers you know that <strong>comparing dates<\/strong> <em>as dates<\/em> is important, as opposed to comparing dates as strings.<\/p>\n<p><strong>Shorthand for If\/Then statements:<\/strong><\/p>\n<p>There&#8217;s a shorthand you can use for <strong>If\/Then<\/strong> statements that goes like this:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{{ IfThenElse(condition, true result, false result) }}\r\n<\/pre>\n<p>Here&#8217;s an example:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{{ IfThenElse(DaysSinceLastContact &gt; 30, &quot;It's been a while...&quot;, &quot;Hope I'm not annoying you...&quot;) }}\r\n<\/pre>\n<p>In this example, if <strong>DaysSinceLastContact<\/strong> is <strong>greater than 30<\/strong>, then &#8220;It&#8217;s been a while&#8230;&#8221; is used, otherwise &#8220;Hope I&#8217;m not annoying you&#8230;&#8221; is used.<\/p>\n<p><strong>Using boolean logic<\/strong><\/p>\n<p>You can combine conditions with AND, OR, and parentheses.<\/p>\n<p>Example using OR:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\"> \r\n{{If Industry=&quot;Recruiting&quot; OR Industry=&quot;HeadHunting&quot; Then}} \r\n{FirstName}, hope your business is going well and you're placing lots of candidates!\r\n{{End If}} \r\n<\/pre>\n<p>Example using AND:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{{If CDate(LastPurchaseDate) &gt;= CDate(&quot;1\/1\/26&quot;) AND CDate(LastPurchaseDate) &lt;= CDate(&quot;5\/15\/26&quot;) Then}}\r\n\r\nThanks for supporting us with a purchase early this year. You last purchased on {LastPurchaseDate}.\r\n\r\n{{Else}}\r\n\r\nIt's been a while since we've heard from you. Can we help you with your next purchase?\r\n\r\n{{End If}}\r\n<\/pre>\n<p>Example combining conditions using parentheses:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\"> \r\n{{If (Industry=&quot;Recruiting&quot; OR Industry=&quot;HeadHunting&quot;) AND CDate(LastPurchase) &gt; CDate(&quot;1\/1\/26&quot;) Then}} \r\n{FirstName}, hope your people business is going well and you're placing lots of candidates! Also thanks for your business in 2026.\r\n{{Else}}\r\nIt's been a while! Can I help you with anything in your business?\r\n{{End If}} \r\n<\/pre>\n<p><strong>Randomize text using the &#8220;spin&#8221; command:<\/strong><\/p>\n<p>You can also <strong>randomize<\/strong> text, based on a set of variations. Let&#8217;s say you want to provide a random greeting for each of your email recipients:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{{spin}}\r\nHey there!\r\n{{variation}}\r\nHello there!\r\n{{variation}}\r\nHi there friend!\r\n{{end spin}}\r\n<\/pre>\n<h2>Three Easy and Practical Examples<\/h2>\n<h3><span style=\"color: #993366;\">Example One: Getting rid of the annoying space in greetings<\/span><\/h3>\n<p><a href=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/005-example-of-the-greeting-41kb.png\" data-rel=\"lightbox-image-5\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14851 size-full\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/005-example-of-the-greeting-41kb.png\" alt=\"example of the greeting\" width=\"1251\" height=\"672\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/005-example-of-the-greeting-41kb.png 1251w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/005-example-of-the-greeting-41kb-300x161.png 300w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/005-example-of-the-greeting-41kb-768x413.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/005-example-of-the-greeting-41kb-1024x550.png 1024w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/005-example-of-the-greeting-41kb-24x13.png 24w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/005-example-of-the-greeting-41kb-36x19.png 36w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/005-example-of-the-greeting-41kb-48x26.png 48w\" sizes=\"auto, (max-width: 1251px) 100vw, 1251px\" \/><\/a><\/p>\n<p>One of the <strong>personalization dilemmas<\/strong> every seasoned email marketer experiences at some point in their careers is dealing with the <strong>extra &#8220;space&#8221; in the greeting<\/strong> when you <strong>don&#8217;t know a prospect&#8217;s first name<\/strong>. Let&#8217;s say your email list contains first names for half of your email addresses only. You want your email to begin:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nHey {FirstName},\r\n<\/pre>\n<p>for those people where you know the first name, but just:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nHey,\r\n<\/pre>\n<p>for those whose first names you don&#8217;t know.<\/p>\n<p>If you compose your campaign with &#8220;Hey {FirstName},&#8221; then for the recipients that don&#8217;t have first names will see:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nHey ,\r\n<\/pre>\n<p>and now you see the problem. There&#8217;s that extra space before the comma. Conditional content solves this problem easily:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{{ IfThenElse(FirstName != &quot;&quot;, &quot;Hey {FirstName},&quot;, &quot;Hey,&quot;) }}\r\n<\/pre>\n<p>What this code block does says is, if the first name isn&#8217;t blank, then output &#8220;Hey {FirstName},&#8221;, and if it is blank then use &#8220;Hey,&#8221;. Problem solved, no extra annoying space.<\/p>\n<h3><span style=\"color: #993366;\">Example Two: Greet people in their own language<\/span><\/h3>\n<p>If you know the country of each of your email list recipients, it&#8217;s easy to output the greeting in their primary language. For example, if you have a <strong>Country<\/strong> column in your <strong>Google Sheet<\/strong>, you can do this:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{{If Country=&quot;USA&quot; Then}}\r\n\r\nGood day!\r\n\r\n{{Else If Country=&quot;France&quot; Then}}\r\n\r\nBonjour!\r\n\r\n{{Else if Country=&quot;Germany&quot; Then}}\r\n\r\nGuten Tag!\r\n\r\n{{Else If Country=&quot;India&quot; Then}}\r\n\r\nNamaste!\r\n\r\n{{Else}}\r\n\r\nHi!\r\n\r\n{{End If}}\r\n<\/pre>\n<p>But what if you <em>don&#8217;t know the country<\/em> for each prospect? You can still greet people in their primary language by looking for a country designation within the email address. For example, we know that john@company.co.uk is a United Kingdom address, and we know that john@mail.ru is a Russian address. So with the magic of conditional content, we can do this:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{{If Right(EmailAddress, 3) = &quot;.fr&quot; Then}}\r\n\r\nBonjour!\r\n\r\n{{Else If Right(EmailAddress, 3) = &quot;.de&quot; Then}}\r\n\r\nGuten Tag!\r\n\r\n{{Else If Right(EmailAddress, 3) = &quot;.in&quot; Then}}\r\n\r\nNamaste!\r\n\r\n{{Else}}\r\n\r\nHi!\r\n\r\n{{End If}}\r\n<\/pre>\n<p>Here I&#8217;m using the <strong>Right<\/strong> command to examine the <strong>three rightmost characters<\/strong> of the <strong>EmailAddress<\/strong> value to determine if it&#8217;s a country-specific address. You can also parse string values with the <strong>Left<\/strong> command the the <strong>Contains<\/strong> command. A <strong>flawed<\/strong> version of the above sample looks like this:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{{If Contains(EmailAddress, &quot;.fr) Then}}\r\n\r\nBonjour!\r\n\r\n{{Else If Contains(EmailAddress, &quot;.de) Then}}\r\n\r\nGuten Tag!\r\n\r\n{{Else If Contains(EmailAddress, &quot;.in) Then}}\r\n\r\nNamaste!\r\n\r\n{{Else}}\r\n\r\nHi!\r\n\r\n{{End If}}\r\n<\/pre>\n<p><strong>Why is this version flawed?<\/strong> Because it&#8217;s not enough to check whether an email address simply contains &#8220;.fr&#8221; because the address john.frank@gmail.com contains &#8220;.fr&#8221; but is not a French address. It&#8217;s important to look at the <strong>rightmost<\/strong> characters, not just check whether the email address <em>contains<\/em> the characters.<\/p>\n<h3><span style=\"color: #993366;\">Example 3: A SaaS platform emailing both free and paid users<\/span><\/h3>\n<p>As the creator of GMass, I send out an email announcement to all of my users whenever there&#8217;s a hot new feature I&#8217;ve just launched, like this one, ahem ahem. Now I can vary my opening line based on whether the user is a freemium user or a paid subscriber.<\/p>\n<p>Let&#8217;s say I have a column in my spreadsheet called <strong>AccountType<\/strong> that is either &#8220;free&#8221; or &#8220;paid&#8221;.<\/p>\n<p><a href=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/006-example-of-account-types-313kb.png\" data-rel=\"lightbox-image-6\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14853 size-full\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/006-example-of-account-types-313kb.png\" alt=\"example of account types\" width=\"1254\" height=\"1776\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/006-example-of-account-types-313kb.png 1254w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/006-example-of-account-types-313kb-212x300.png 212w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/006-example-of-account-types-313kb-768x1088.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/006-example-of-account-types-313kb-723x1024.png 723w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/006-example-of-account-types-313kb-17x24.png 17w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/006-example-of-account-types-313kb-25x36.png 25w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/006-example-of-account-types-313kb-34x48.png 34w\" sizes=\"auto, (max-width: 1254px) 100vw, 1254px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nHey {FirstName},\r\n\r\n{{If AccountType=&quot;free&quot; Then}}\r\n\r\nAs a freemium user, we're happy to add awesome new features to our platform all the time. We do hope that you'll find value to your life with our SaaS platform and encourage you to subscribe.\r\n\r\n{{Else}}\r\n\r\nThank you for being a paying subscriber and supporting our SaaS platform. We use the money you pay us to build awesome new feautres like this one.\r\n\r\n{{End If}}\r\n<\/pre>\n<p>I used logic similar to this <strong id=\"autofix\">when I announced this feature to the entire GMass user base<\/strong>. See the <a href=\"https:\/\/www.dropbox.com\/s\/0h6g8yo4h6wjidi\/Conditional-Logic-Announcement-Template-web.png?dl=0\" target=\"_blank\" rel=\"noopener noreferrer\" data-rel=\"lightbox-image-7\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\">exact email template I used<\/a>.<\/p>\n<h2>How to have GMass automatically fix potential spacing issues<\/h2>\n<p>When you use conditional content, your email copy will tend to use a lot of line breaks (the tags on their own lines, the different conditional content pieces on their own lines, blank lines in between).<\/p>\n<p><a href=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-spacingdraft-tinified.png\" data-rel=\"lightbox-image-8\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-26132\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-spacingdraft-tinified.png\" alt=\"\" width=\"1630\" height=\"1264\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-spacingdraft-tinified.png 1630w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-spacingdraft-tinified-300x233.png 300w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-spacingdraft-tinified-1024x794.png 1024w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-spacingdraft-tinified-768x596.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-spacingdraft-tinified-1536x1191.png 1536w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-spacingdraft-tinified-24x19.png 24w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-spacingdraft-tinified-36x28.png 36w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-spacingdraft-tinified-48x37.png 48w\" sizes=\"auto, (max-width: 1630px) 100vw, 1630px\" \/><\/a><\/p>\n<p>The result, though, can be some unnecessary blank lines in your emails.<\/p>\n<p><a href=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-extralinebreaks2-tinified.png\" data-rel=\"lightbox-image-9\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-26137\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-extralinebreaks2-tinified.png\" alt=\"\" width=\"1908\" height=\"1344\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-extralinebreaks2-tinified.png 1908w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-extralinebreaks2-tinified-300x211.png 300w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-extralinebreaks2-tinified-1024x721.png 1024w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-extralinebreaks2-tinified-768x541.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-extralinebreaks2-tinified-1536x1082.png 1536w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-extralinebreaks2-tinified-24x17.png 24w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-extralinebreaks2-tinified-36x25.png 36w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-extralinebreaks2-tinified-48x34.png 48w\" sizes=\"auto, (max-width: 1908px) 100vw, 1908px\" \/><\/a><\/p>\n<p>Fortunately, there&#8217;s a fix for that.<\/p>\n<p>Head to your\u00a0<strong>GMass dashboard<\/strong>, go to the\u00a0<strong>Other<\/strong> section, and check the box next to\u00a0<strong>Auto fix conditional logical spacing<\/strong>. (Then click\u00a0<strong>Save settings<\/strong>.)<\/p>\n<p><a href=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-autofixspacing-tinified.png\" data-rel=\"lightbox-image-10\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-26134\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-autofixspacing-tinified.png\" alt=\"\" width=\"1908\" height=\"1060\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-autofixspacing-tinified.png 1908w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-autofixspacing-tinified-300x167.png 300w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-autofixspacing-tinified-1024x569.png 1024w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-autofixspacing-tinified-768x427.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-autofixspacing-tinified-1536x853.png 1536w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-autofixspacing-tinified-24x13.png 24w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-autofixspacing-tinified-36x20.png 36w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-autofixspacing-tinified-48x27.png 48w\" sizes=\"auto, (max-width: 1908px) 100vw, 1908px\" \/><\/a><\/p>\n<p>Now, when you use conditional formatting, GMass will automatically get rid of any extra blank lines to keep your formatting nice and proper.<\/p>\n<p>(Also notice in my example, the second, inline conditional formatting at the bottom isn&#8217;t affected by the auto fixing.)<\/p>\n<p><a href=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-fixedspacing2-tinified.png\" data-rel=\"lightbox-image-11\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-26138\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-fixedspacing2-tinified.png\" alt=\"\" width=\"1908\" height=\"1186\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-fixedspacing2-tinified.png 1908w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-fixedspacing2-tinified-300x186.png 300w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-fixedspacing2-tinified-1024x637.png 1024w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-fixedspacing2-tinified-768x477.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-fixedspacing2-tinified-1536x955.png 1536w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-fixedspacing2-tinified-24x15.png 24w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-fixedspacing2-tinified-36x22.png 36w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/conditional-fixedspacing2-tinified-48x30.png 48w\" sizes=\"auto, (max-width: 1908px) 100vw, 1908px\" \/><\/a><\/p>\n<h2>Gmail might mangle your code, but that&#8217;s okay!<\/h2>\n<p>When you write your script in the Gmail Compose, if you look at the HTML that&#8217;s created behind the scenes, you&#8217;ll notice that elements of your code are turned into HTML entities. For example, if in my <strong>Compose<\/strong> window I have:<\/p>\n<p><a href=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/007-conditional-email-in-compose-window-56kb.png\" data-rel=\"lightbox-image-12\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14856 size-full\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/007-conditional-email-in-compose-window-56kb.png\" alt=\"conditional email in compose window\" width=\"1260\" height=\"780\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/007-conditional-email-in-compose-window-56kb.png 1260w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/007-conditional-email-in-compose-window-56kb-300x186.png 300w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/007-conditional-email-in-compose-window-56kb-768x475.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/007-conditional-email-in-compose-window-56kb-1024x634.png 1024w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/007-conditional-email-in-compose-window-56kb-24x15.png 24w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/007-conditional-email-in-compose-window-56kb-36x22.png 36w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/007-conditional-email-in-compose-window-56kb-48x30.png 48w\" sizes=\"auto, (max-width: 1260px) 100vw, 1260px\" \/><\/a><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{{ If CDate(LastPurchase) &gt; CDate(&quot;1\/1\/20&quot;) Then}}\r\nThanks for your purchase this year!\r\n{{ End If }}\r\n<\/pre>\n<p>If I look at the HTML behind the Compose, I&#8217;ll see this:<\/p>\n<figure id=\"attachment_14857\" aria-describedby=\"caption-attachment-14857\" style=\"width: 2032px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/008-conditional-HTML-behind-email-compose-window-90kb.png\" data-rel=\"lightbox-image-13\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-14857 size-full\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/008-conditional-HTML-behind-email-compose-window-90kb.png\" alt=\"conditional HTML behind email compose window\" width=\"2032\" height=\"468\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/008-conditional-HTML-behind-email-compose-window-90kb.png 2032w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/008-conditional-HTML-behind-email-compose-window-90kb-300x69.png 300w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/008-conditional-HTML-behind-email-compose-window-90kb-768x177.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/008-conditional-HTML-behind-email-compose-window-90kb-1024x236.png 1024w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/008-conditional-HTML-behind-email-compose-window-90kb-24x6.png 24w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/008-conditional-HTML-behind-email-compose-window-90kb-36x8.png 36w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/008-conditional-HTML-behind-email-compose-window-90kb-48x11.png 48w\" sizes=\"auto, (max-width: 2032px) 100vw, 2032px\" \/><\/a><figcaption id=\"caption-attachment-14857\" class=\"wp-caption-text\">The &gt; symbol has turned into &amp;gt;<\/figcaption><\/figure>\n<p>Notice how the &#8220;greater than&#8221; sign has turned into the HTML entity &amp;gt; instead of just the &gt; symbol. GMass knows to look for those and treat them as their encoded equivalent, so you don&#8217;t have to worry that those aren&#8217;t actual double quotes. This is the benefit of building this feature from scratch with our own custom compiler.<\/p>\n<h2>Testing your script before you send<\/h2>\n<p>The easiest way to test your script to make sure your syntax is correct and your logic is correct is to:<\/p>\n<ol>\n<li>Set your campaign to <strong>Create Drafts<\/strong><\/li>\n<li>Enter a few addresses that will have varying conditions in the <strong>&#8220;Send Test&#8221; box<\/strong><\/li>\n<li>Click <strong>&#8220;Send Test Email&#8221;<\/strong><\/li>\n<\/ol>\n<figure id=\"attachment_15536\" aria-describedby=\"caption-attachment-15536\" style=\"width: 640px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/test-conditional-content-web-1.png\" data-rel=\"lightbox-image-14\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-15536\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/test-conditional-content-web-1-899x1024.png\" alt=\"\" width=\"640\" height=\"729\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/test-conditional-content-web-1-899x1024.png 899w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/test-conditional-content-web-1-263x300.png 263w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/test-conditional-content-web-1-768x875.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/test-conditional-content-web-1-21x24.png 21w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/test-conditional-content-web-1-32x36.png 32w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/test-conditional-content-web-1-42x48.png 42w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/test-conditional-content-web-1.png 1178w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><figcaption id=\"caption-attachment-15536\" class=\"wp-caption-text\">The easiest way to test your conditional logic code is to set your campaign to Create Drafts and then use the &#8220;Send Test&#8221; button.<\/figcaption><\/figure>\n<p>By doing this, <strong>DRAFTS will be created for each address entered<\/strong>. You can <strong>use addresses from your actual list that represent different conditions<\/strong> and you can avoid having to use your own addresses to test what the final email will look like, since no actual emails will be sent when testing this way. <em>Remember to set your campaign back to &#8220;Send emails&#8221; when you&#8217;re done testing.<\/em><\/p>\n<p><strong>Another way<\/strong> is to create a <strong>separate Worksheet<\/strong> in your <strong>Google Sheet<\/strong> containing just <strong>sample rows<\/strong> using<strong> test addresses that you own<\/strong>\u00a0and then <strong>sending a test to the addresses<\/strong> in that Worksheet prior to sending to your full list.<\/p>\n<h2>Avoid spaces in variables<\/h2>\n<p>In our <a href=\"https:\/\/www.gmass.co\/blog\/google-sheets-mail-merge\/\">document on using Google Sheets<\/a>, in the section on <a href=\"https:\/\/www.gmass.co\/blog\/google-sheets-mail-merge\/#gmass:~:text=Formatting%20Your%20Spreadsheet\">formatting<\/a> we recommend that column headings contain <strong>only alphanumeric characters and no spaces<\/strong>. That means using column headings like &#8220;FirstName&#8221; rather than &#8220;First Name&#8221; or &#8220;First-Name&#8217;. This is to ensure the highest accuracy with personalization as possible. Spaces and non-alphanumeric characters introduce edge cases which can cause unexpected results. For example, if you use &#8220;First Name&#8221;, and then when you use the merge tag {First Name}, the two words end up getting split onto two different lines, that will break personalization.<\/p>\n<p>Sometimes, however, avoiding a space or non-alphanumeric character isn&#8217;t possible and for those situations, you should wrap your variable name in the <strong>VAR<\/strong> command. GMass intelligently <a href=\"https:\/\/www.gmass.co\/blog\/new-feature-detect-a-persons-first-name-from-just-an-email-address\/\">deciphers first names from email addresses<\/a> and puts those first names in a variable called <strong>auto-first<\/strong> so you can have &#8220;Dear {auto-first}&#8221; in your email. But to use that variable in conditional logic requires the use of the <strong>VAR<\/strong> command because of the hyphen in the variable name.<\/p>\n<p>This will NOT work.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{{ If auto-first != &quot;&quot; Then}}\r\nI believe your first name is {auto-first}\r\n{{ Else }}\r\nI know your email address is {EmailAddress}, but I couldn't figure out your first name.\r\n{{ End If }}\r\n<\/pre>\n<p>But this WILL work.<a id=\"error\" name=\"error\"><\/a><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{{ If var(&quot;auto-first&quot;) != &quot;&quot; Then}}\r\nI believe your first name is {auto-first}\r\n{{ Else }}\r\nI know your email address is {EmailAddress}, but I couldn't figure out your first name.\r\n{{ End If }}\r\n<\/pre>\n<h2>Error handling<\/h2>\n<p>It&#8217;s easy to make a mistake when writing conditional code. When you go to send your campaign, if an individual email that&#8217;s part of the campaign encounters an error, that email recipient will be skipped and the campaign will continue sending. If you have a syntax error in your scripting, then all emails in the campaign will fail. When <strong>10 consecutive emails<\/strong> error out, then the <strong>whole campaign will stop<\/strong>.<\/p>\n<p>You are notified in all cases of any errors in your conditional scripting.<\/p>\n<p>Here are the most common errors.<\/p>\n<p><span style=\"color: #ff0000;\">1. Forgetting the closing {{End If}}<\/span><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{{If Industry=&quot;Recruiting&quot; Then}}\r\nHope the recruiting business is going well and you're placing lots of candidates! [There is no &quot;End If&quot; block]\r\nLet's set up a call to catch up. When is good for you? \r\n<\/pre>\n<p><span style=\"color: #ff0000;\">2. Forgetting to begin\/end all code blocks with double braces<\/span><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{{If Industry=&quot;Recruiting&quot; Then}}\r\nHope the recruiting business is going well and you're placing lots of candidates!\r\n{{End If} [The ending block has only one curly bracket instead of two.]\r\nLet's set up a call to catch up.\r\nWhen is good for you?\r\n<\/pre>\n<p><span style=\"color: #ff0000;\">3. Forgetting the keyword &#8220;Then&#8221;<\/span><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{{If Industry=&quot;Recruiting&quot;}} [The word &quot;Then&quot; is missing]\r\nHope the recruiting business is going well and you're placing lots of candidates!\r\n{{End If}\r\nLet's set up a call to catch up.\r\nWhen is good for you?\r\n<\/pre>\n<h2>The philosophy behind this feature<\/h2>\n<p>In building our conditional content feature, we wrote our own compiler and mimicked an old deprecated Microsoft language called <a href=\"https:\/\/www.w3schools.com\/asp\/asp_ref_vbscript_functions.asp\">VBScript<\/a> for the commands and syntax. <strong>VBScript<\/strong> used to be one of the easiest languages for beginning programmers to learn, and while it isn&#8217;t used widely today, its syntax and logic make it the perfect email scripting language given its ease of use.<\/p>\n<p>We also analyzed the conditional content feature of a few other email platforms like <a href=\"https:\/\/mailchimp.com\/help\/use-conditional-merge-tag-blocks\/\">Mailchimp<\/a>, <a href=\"https:\/\/www.activecampaign.com\/learn\/guides\/a-guide-to-conditional-content\">ActiveCampaign<\/a>, and Lemlist, and found weaknesses in each, so we decided to build something better. I hope you think we succeeded in that mission.<\/p>\n<h2>Compatibility with other systems<\/h2>\n<p>We&#8217;ve specifically chosen the syntax of one curly bracket for mail merge variable substitution and two curly braces for conditional logic to avoid confusion for users who want to personalize with simple mail merge variables and not be bothered with seeing code show up when designing their personalization schemes in email campaigns. This presents a challenge, however, because many other email service providers use the double curly braces syntax for regular old mail merge variable substitution. In <strong>Mixmax<\/strong> for example, if you want to personalize with a variable called &#8220;firstname&#8221;, you would write:<\/p>\n<p>{{firstname}}<\/p>\n<p>Many users <strong>copy\/paste<\/strong> their <a href=\"https:\/\/www.gmass.co\/blog\/campaign-templates-in-gmail\/\">email templates<\/a> from other systems into GMass, and include variables surrounded by double curly braces. To prevent &#8220;breaking&#8221; these templates, GMass will attempt to determine if the syntax inside double curly braces is truly conditional logic or is just a mail merge variable and will treat each scenario appropriately.<\/p>\n<h2>Other personalization options<\/h2>\n<p>Conditional content is just one of the many, and the most sophisticated, ways of personalizing your email campaigns. For regular old merge tag substitution personalization, see our <a href=\"https:\/\/www.gmass.co\/blog\/mail-merge-personalization\/\">guide to personalization<\/a>. Earlier, I mentioned how you can solve the annoying &#8220;space&#8221; issue when you don&#8217;t have someone&#8217;s first name, but we also provide a way of <a href=\"https:\/\/www.gmass.co\/blog\/new-feature-detect-a-persons-first-name-from-just-an-email-address\">auto detecting first names<\/a>. For our full set of personalization documentation see the <a href=\"https:\/\/www.gmass.co\/blog\/category\/personalization\/\">personalization category page<\/a> on this blog.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s important to personalize your emails. Now you can hyper-personalize your outreach emails with conditional content using simple If\/Then statements in the Subject and Body of your message.\u2026<\/p>\n","protected":false},"author":2,"featured_media":14866,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[4263],"tags":[],"class_list":["post-14824","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-personalization"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\r\n<title>Conditional Content in Email Campaigns (Using If...Then for Precise Personalization)<\/title>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/www.gmass.co\/blog\/conditional-content\/\" \/>\r\n<meta property=\"og:locale\" content=\"en_US\" \/>\r\n<meta property=\"og:type\" content=\"article\" \/>\r\n<meta property=\"og:title\" content=\"Conditional Content in Email Campaigns (Using If...Then for Precise Personalization)\" \/>\r\n<meta property=\"og:description\" content=\"It&#8217;s important to personalize your emails. Now you can hyper-personalize your outreach emails with conditional content using simple If\/Then statements in the Subject and Body of your message.\u2026\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/www.gmass.co\/blog\/conditional-content\/\" \/>\r\n<meta property=\"og:site_name\" content=\"GMass Blog\" \/>\r\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/GmailMailMerge\/\" \/>\r\n<meta property=\"article:published_time\" content=\"2020-12-14T07:21:55+00:00\" \/>\r\n<meta property=\"article:modified_time\" content=\"2026-05-26T18:29:44+00:00\" \/>\r\n<meta property=\"og:image\" content=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/Featured-image-conditional-email-formatting-v3-39kb.png\" \/>\r\n\t<meta property=\"og:image:width\" content=\"2002\" \/>\r\n\t<meta property=\"og:image:height\" content=\"934\" \/>\r\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\r\n<meta name=\"author\" content=\"Ajay Goel\" \/>\r\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\r\n<meta name=\"twitter:creator\" content=\"@PartTimeSnob\" \/>\r\n<meta name=\"twitter:site\" content=\"@GMassForGmail\" \/>\r\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ajay Goel\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"15 minutes\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/conditional-content\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/conditional-content\\\/\"},\"author\":{\"name\":\"Ajay Goel\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/#\\\/schema\\\/person\\\/b5fa74f8765b860701158fd77162fff8\"},\"headline\":\"Conditional Content in Email Campaigns (Using If&#8230;Then for Precise Personalization)\",\"datePublished\":\"2020-12-14T07:21:55+00:00\",\"dateModified\":\"2026-05-26T18:29:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/conditional-content\\\/\"},\"wordCount\":2984,\"commentCount\":16,\"image\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/conditional-content\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/Featured-image-conditional-email-formatting-v3-39kb.png\",\"articleSection\":[\"Personalization\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.gmass.co\\\/blog\\\/conditional-content\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/conditional-content\\\/\",\"url\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/conditional-content\\\/\",\"name\":\"Conditional Content in Email Campaigns (Using If...Then for Precise Personalization)\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/conditional-content\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/conditional-content\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/Featured-image-conditional-email-formatting-v3-39kb.png\",\"datePublished\":\"2020-12-14T07:21:55+00:00\",\"dateModified\":\"2026-05-26T18:29:44+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/#\\\/schema\\\/person\\\/b5fa74f8765b860701158fd77162fff8\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/conditional-content\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.gmass.co\\\/blog\\\/conditional-content\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/conditional-content\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/Featured-image-conditional-email-formatting-v3-39kb.png\",\"contentUrl\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/12\\\/Featured-image-conditional-email-formatting-v3-39kb.png\",\"width\":2002,\"height\":934,\"caption\":\"conditional email formatting\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/conditional-content\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Conditional Content in Email Campaigns (Using If&#8230;Then for Precise Personalization)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/\",\"name\":\"GMass Blog\",\"description\":\"Tips and tricks for sending mail merge and mass email campaigns directly from Gmail\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/#\\\/schema\\\/person\\\/b5fa74f8765b860701158fd77162fff8\",\"name\":\"Ajay Goel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f3a70af05bbabe47925150d5a1320540e801b78055a74da20658fc97cd0706a2?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f3a70af05bbabe47925150d5a1320540e801b78055a74da20658fc97cd0706a2?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f3a70af05bbabe47925150d5a1320540e801b78055a74da20658fc97cd0706a2?s=96&d=mm&r=g\",\"caption\":\"Ajay Goel\"},\"description\":\"Ajay is the founder of GMass and has been developing email sending software for 20 years.\",\"sameAs\":[\"https:\\\/\\\/twitter.com\\\/PartTimeSnob\",\"https:\\\/\\\/x.com\\\/PartTimeSnob\"],\"url\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/author\\\/ajay-goel\\\/\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Conditional Content in Email Campaigns (Using If...Then for Precise Personalization)","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.gmass.co\/blog\/conditional-content\/","og_locale":"en_US","og_type":"article","og_title":"Conditional Content in Email Campaigns (Using If...Then for Precise Personalization)","og_description":"It&#8217;s important to personalize your emails. Now you can hyper-personalize your outreach emails with conditional content using simple If\/Then statements in the Subject and Body of your message.\u2026","og_url":"https:\/\/www.gmass.co\/blog\/conditional-content\/","og_site_name":"GMass Blog","article_publisher":"https:\/\/www.facebook.com\/GmailMailMerge\/","article_published_time":"2020-12-14T07:21:55+00:00","article_modified_time":"2026-05-26T18:29:44+00:00","og_image":[{"width":2002,"height":934,"url":"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/Featured-image-conditional-email-formatting-v3-39kb.png","type":"image\/png"}],"author":"Ajay Goel","twitter_card":"summary_large_image","twitter_creator":"@PartTimeSnob","twitter_site":"@GMassForGmail","twitter_misc":{"Written by":"Ajay Goel","Est. reading time":"15 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.gmass.co\/blog\/conditional-content\/#article","isPartOf":{"@id":"https:\/\/www.gmass.co\/blog\/conditional-content\/"},"author":{"name":"Ajay Goel","@id":"https:\/\/www.gmass.co\/blog\/#\/schema\/person\/b5fa74f8765b860701158fd77162fff8"},"headline":"Conditional Content in Email Campaigns (Using If&#8230;Then for Precise Personalization)","datePublished":"2020-12-14T07:21:55+00:00","dateModified":"2026-05-26T18:29:44+00:00","mainEntityOfPage":{"@id":"https:\/\/www.gmass.co\/blog\/conditional-content\/"},"wordCount":2984,"commentCount":16,"image":{"@id":"https:\/\/www.gmass.co\/blog\/conditional-content\/#primaryimage"},"thumbnailUrl":"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/Featured-image-conditional-email-formatting-v3-39kb.png","articleSection":["Personalization"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.gmass.co\/blog\/conditional-content\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.gmass.co\/blog\/conditional-content\/","url":"https:\/\/www.gmass.co\/blog\/conditional-content\/","name":"Conditional Content in Email Campaigns (Using If...Then for Precise Personalization)","isPartOf":{"@id":"https:\/\/www.gmass.co\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.gmass.co\/blog\/conditional-content\/#primaryimage"},"image":{"@id":"https:\/\/www.gmass.co\/blog\/conditional-content\/#primaryimage"},"thumbnailUrl":"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/Featured-image-conditional-email-formatting-v3-39kb.png","datePublished":"2020-12-14T07:21:55+00:00","dateModified":"2026-05-26T18:29:44+00:00","author":{"@id":"https:\/\/www.gmass.co\/blog\/#\/schema\/person\/b5fa74f8765b860701158fd77162fff8"},"breadcrumb":{"@id":"https:\/\/www.gmass.co\/blog\/conditional-content\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.gmass.co\/blog\/conditional-content\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.gmass.co\/blog\/conditional-content\/#primaryimage","url":"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/Featured-image-conditional-email-formatting-v3-39kb.png","contentUrl":"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2020\/12\/Featured-image-conditional-email-formatting-v3-39kb.png","width":2002,"height":934,"caption":"conditional email formatting"},{"@type":"BreadcrumbList","@id":"https:\/\/www.gmass.co\/blog\/conditional-content\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.gmass.co\/blog\/"},{"@type":"ListItem","position":2,"name":"Conditional Content in Email Campaigns (Using If&#8230;Then for Precise Personalization)"}]},{"@type":"WebSite","@id":"https:\/\/www.gmass.co\/blog\/#website","url":"https:\/\/www.gmass.co\/blog\/","name":"GMass Blog","description":"Tips and tricks for sending mail merge and mass email campaigns directly from Gmail","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.gmass.co\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.gmass.co\/blog\/#\/schema\/person\/b5fa74f8765b860701158fd77162fff8","name":"Ajay Goel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f3a70af05bbabe47925150d5a1320540e801b78055a74da20658fc97cd0706a2?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f3a70af05bbabe47925150d5a1320540e801b78055a74da20658fc97cd0706a2?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f3a70af05bbabe47925150d5a1320540e801b78055a74da20658fc97cd0706a2?s=96&d=mm&r=g","caption":"Ajay Goel"},"description":"Ajay is the founder of GMass and has been developing email sending software for 20 years.","sameAs":["https:\/\/twitter.com\/PartTimeSnob","https:\/\/x.com\/PartTimeSnob"],"url":"https:\/\/www.gmass.co\/blog\/author\/ajay-goel\/"}]}},"_links":{"self":[{"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/posts\/14824","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/comments?post=14824"}],"version-history":[{"count":65,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/posts\/14824\/revisions"}],"predecessor-version":[{"id":26147,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/posts\/14824\/revisions\/26147"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/media\/14866"}],"wp:attachment":[{"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/media?parent=14824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/categories?post=14824"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/tags?post=14824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}