{"id":462,"date":"2019-02-18T23:25:21","date_gmt":"2019-02-18T23:25:21","guid":{"rendered":"http:\/\/gearmage.com\/blog\/?p=462"},"modified":"2026-02-05T22:49:32","modified_gmt":"2026-02-05T22:49:32","slug":"nesting-email-rules-and-actions","status":"publish","type":"post","link":"https:\/\/gearmage.com\/blog\/nesting-email-rules-and-actions\/","title":{"rendered":"Nesting email rules and actions"},"content":{"rendered":"\n<p>Latest builds of v3.2 provides new capabilities such as nesting rules or actions. Make sure you <a href=\"https:\/\/gearmage.zohodesk.com\/portal\/en\/kb\/articles\/latest-pro-client-and-pro-server-builds-how-to-get-them\">upgrade the build<\/a> to the latest before you proceed to read through this blog post.<\/p>\n\n\n\n<p>This blog post explores how you can nest rules or nest actions like a PRO.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Nesting rules<\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-style-default is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Preface<\/strong> &#8211; Processing emails with <a href=\"https:\/\/gearmage.com\/blog\/save-emails-and-attachments-to-folders\/\">Global filters<\/a> offers the ability to save emails or attachments into different folders based on some criteria and take actions on them.<\/p><p>You do not need to learn about nesting (described here) for most common cases. Nesting is only useful for advanced cases.<\/p><p>If you are not familiar yet with the Global filters, we have a great <a href=\"https:\/\/gearmage.com\/blog\/save-emails-and-attachments-to-folders\/\">blog post here<\/a> that should help you get started.<\/p><p>Proceed to read on only if you are familiar with how Global filters work.<\/p><cite><strong>STOP here <\/strong>and read through <a href=\"https:\/\/gearmage.com\/blog\/save-emails-and-attachments-to-folders\/\">this blog post<\/a> to familiarize yourself with Global filters<\/cite><\/blockquote>\n\n\n\n<p>This post is about how nesting rules can come in handy when you want to cover some advanced scenarios. Some examples where this can be useful include:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>When no rules match for a specific email, perform certain actions such as move emails to an error folder that you can take a look at.<\/li><li>When you may have multiple attachments in an email each of which have different possible actions.<\/li><li>When you want to share a set of actions or email filters amongst many rules so you don&#8217;t have to re-type them all over again. <\/li><\/ul>\n\n\n\n<p>The global filters tab in the PRO versions offer you the ability to define three types of rule filters: an <strong>Email Filter<\/strong>, a <strong>Global Rule<\/strong> or a <strong>Negative Rule<\/strong>, <strong>Shared Action<\/strong>. The <strong>Rule Type<\/strong> dropdown (shown below) enables you to select the type of the rule.<\/p>\n\n\n\n<p>Read on to explore the different rule types below by using an example.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p style=\"text-align:left\"><strong>Tutorial with an Example&#8230;.<\/strong><\/p>\n\n\n\n<p style=\"text-align:left\"><strong>Example:<\/strong> Consider an example where we want to target all emails that have the term &#8220;Invoice ID&#8221; in the Subject. We also want to move the .pdf&#8217;s in such emails to a PDF prefixed folder and .doc&#8217;s in such emails to another folder prefixed by doc. Also, if no pdf or doc&#8217;s are present, we&#8217;ll move the email to an &#8220;Issues&#8221; folder. And lastly we want to use a Shared Action to save the doc\/pdf related email header data (from\/to\/subject etc.) to a database.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"840\" height=\"140\" src=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/11.-Nesting-rules-types.png?resize=840%2C140&#038;ssl=1\" alt=\"Rule types in an email rule\" class=\"wp-image-463\" srcset=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/11.-Nesting-rules-types.png?resize=1024%2C171&amp;ssl=1 1024w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/11.-Nesting-rules-types.png?resize=300%2C50&amp;ssl=1 300w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/11.-Nesting-rules-types.png?resize=768%2C129&amp;ssl=1 768w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/11.-Nesting-rules-types.png?w=1494&amp;ssl=1 1494w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><figcaption>Different <strong>Rule Type&#8217;s<\/strong> in a Global filter rule<\/figcaption><\/figure>\n\n\n\n<p>Let&#8217;s start by creating a new Email Filter. <\/p>\n\n\n\n<p>Go to the Global filters tab and Add new, in the popup select the Rule Type as shown above and change it to <strong>Email Filter<\/strong> if it&#8217;s not already selected.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Email Filter: <\/strong>This enables you to instruct the program to filter processing to either a specific email or to target a group of emails matching the filters you specify here. This rule does not, in and of itself, enable you to save emails or attachments to folders or even define actions that you can take after saving files. Those sections will show up disabled as a result.<\/p><cite>Read on to see how <strong>Email Filters <\/strong>can have <strong>Global Rules<\/strong> as child rules&#8230;<\/cite><\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"840\" height=\"296\" src=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-6.png?resize=840%2C296&#038;ssl=1\" alt=\"\" class=\"wp-image-474\" srcset=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-6.png?resize=1024%2C361&amp;ssl=1 1024w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-6.png?resize=300%2C106&amp;ssl=1 300w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-6.png?resize=768%2C270&amp;ssl=1 768w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-6.png?w=1488&amp;ssl=1 1488w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><figcaption>An <strong>Email Filter<\/strong> that matches emails with the Subject containing &#8220;Invoice ID&#8221;<\/figcaption><\/figure>\n\n\n\n<p>You can then save this rule and it&#8217;ll show up in the Global filters tab as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"840\" height=\"372\" src=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-1.png?resize=840%2C372&#038;ssl=1\" alt=\"\" class=\"wp-image-468\" srcset=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-1.png?resize=1024%2C453&amp;ssl=1 1024w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-1.png?resize=300%2C133&amp;ssl=1 300w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-1.png?resize=768%2C340&amp;ssl=1 768w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-1.png?w=1302&amp;ssl=1 1302w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><figcaption>Global filters tab showing one <strong>Email Filter<\/strong><\/figcaption><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Global Rule: <\/strong>This type of rule enables you to specify which attachments you want to filter down to and where to save them. It also enables you to define actions that you can take after saving the file. You can define a Global Rule as a standalone rule (at the root level) or as a child of an Email Filter.<\/p><cite>Read on to see how you can setup multiple <strong>Global Rule<\/strong>&#8216;s to save files to different folders<\/cite><\/blockquote>\n\n\n\n<p>To create a Global Rule as a child of an Email Filter, right click on the email filter and add a new Global rule as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"840\" height=\"605\" src=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-2.png?resize=840%2C605&#038;ssl=1\" alt=\"\" class=\"wp-image-470\" srcset=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-2.png?resize=1024%2C738&amp;ssl=1 1024w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-2.png?resize=300%2C216&amp;ssl=1 300w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-2.png?resize=768%2C553&amp;ssl=1 768w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-2.png?w=1830&amp;ssl=1 1830w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-2.png?w=1680&amp;ssl=1 1680w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><figcaption>Add a new <strong>Global Rule <\/strong>as a child of the<strong> Email Filter&nbsp;<\/strong>defined earlier<\/figcaption><\/figure>\n\n\n\n<p>Let&#8217;s have this rule save the email attachments that are PDFs to a &#8220;PDF&#8221; folder. This has a filter of Attachment count greater than and a filename option of pdf.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"840\" height=\"756\" src=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-8.png?resize=840%2C756&#038;ssl=1\" alt=\"\" class=\"wp-image-476\" srcset=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-8.png?resize=1024%2C922&amp;ssl=1 1024w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-8.png?resize=300%2C270&amp;ssl=1 300w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-8.png?resize=768%2C691&amp;ssl=1 768w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-8.png?w=1480&amp;ssl=1 1480w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><figcaption><strong>Global Rule<\/strong> that saves PDFs to a prefixed folder pdf\\ as highlighted<\/figcaption><\/figure>\n\n\n\n<p>Since this is a &#8220;child rule&#8221; of the Email Filter we defined above, the Global Rule will only run for emails with a subject that contains &#8220;Invoice ID&#8221; that we defined earlier. We have also setup a <strong>Mark as read <\/strong>action as shown above. You can add any other action like Move email to folder to move the email to a different folder if you want.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"840\" height=\"525\" src=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-9.png?resize=840%2C525&#038;ssl=1\" alt=\"\" class=\"wp-image-477\" srcset=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-9.png?resize=1024%2C640&amp;ssl=1 1024w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-9.png?resize=300%2C188&amp;ssl=1 300w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-9.png?resize=768%2C480&amp;ssl=1 768w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-9.png?w=1302&amp;ssl=1 1302w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><figcaption>Global filters showing Global Rule that&#8217;s a child of the Email Filter<\/figcaption><\/figure>\n\n\n\n<p>Now, let&#8217;s define another Global Rule that saves .doc or .docx&#8217;s into a different folder. Right click again on the <strong>Email Filter<\/strong> in the Global filters tab and select Add new -&gt; Global Rule. Setup the Global Rule as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"840\" height=\"754\" src=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-12.png?resize=840%2C754&#038;ssl=1\" alt=\"\" class=\"wp-image-480\" srcset=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-12.png?resize=1024%2C919&amp;ssl=1 1024w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-12.png?resize=300%2C269&amp;ssl=1 300w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-12.png?resize=768%2C690&amp;ssl=1 768w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-12.png?w=1488&amp;ssl=1 1488w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><figcaption>Global Rule: Save docx or doc extension attachments to a doc\\ prefixed folder<\/figcaption><\/figure>\n\n\n\n<p>At this point you should see Global filters tab as shown below (Email Filter being the parent with two child Global Rules).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"840\" height=\"527\" src=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-13.png?resize=840%2C527&#038;ssl=1\" alt=\"\" class=\"wp-image-481\" srcset=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-13.png?resize=1024%2C642&amp;ssl=1 1024w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-13.png?resize=300%2C188&amp;ssl=1 300w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-13.png?resize=768%2C481&amp;ssl=1 768w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-13.png?w=1296&amp;ssl=1 1296w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p> <strong>Negative Rule: <\/strong>This type of rule lets you specify &#8220;catch-all&#8221; actions when none of the <strong>Global Rules<\/strong> match. To do this, we will right click on the Email Filter again and select Add new -&gt; Negative Rule. This type of rule doesn&#8217;t offer you the ability to save anything (this will show up disabled).<\/p><cite>Read on how to setup a <strong>Negative Rule <\/strong>under an Email Filter as a &#8220;catch-all&#8221; rule<\/cite><\/blockquote>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"840\" height=\"645\" src=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-14.png?resize=840%2C645&#038;ssl=1\" alt=\"\" class=\"wp-image-482\" srcset=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-14.png?resize=1024%2C786&amp;ssl=1 1024w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-14.png?resize=300%2C230&amp;ssl=1 300w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-14.png?resize=768%2C589&amp;ssl=1 768w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-14.png?w=1702&amp;ssl=1 1702w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><figcaption>Adding a <strong>Negative Rule<\/strong><\/figcaption><\/figure>\n\n\n\n<p>Let&#8217;s now configure the Negative Rule to copy the email to the &#8220;Issues&#8221; mailbox folder.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"840\" height=\"752\" src=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-16.png?resize=840%2C752&#038;ssl=1\" alt=\"\" class=\"wp-image-484\" srcset=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-16.png?resize=1024%2C917&amp;ssl=1 1024w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-16.png?resize=300%2C269&amp;ssl=1 300w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-16.png?resize=768%2C687&amp;ssl=1 768w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-16.png?w=1488&amp;ssl=1 1488w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><figcaption>If no <strong>Global Rule<\/strong>&#8216;s match for this<strong> Email Filter<\/strong>, move email to the &#8216;Issues&#8217; mailbox folder<\/figcaption><\/figure>\n\n\n\n<p>Lastly, lets create a <strong>Shared Action<\/strong>. Go to the Global filters tab and right click anywhere (not on the Email Filter like we did earlier as Shared Action will show up disabled if you do that). Then select Add new -&gt; Shared Action.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Shared Action: <\/strong>This type of rule has no save options enabled but will have additional filters or actions that you can define. These actions are those that you want to share amongst many Global Rules.<\/p><cite>Read on to see how to use a <strong>Shared Action <\/strong>to save email data to a DB<\/cite><\/blockquote>\n\n\n\n<p>We&#8217;ll create a new Shared Action as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"840\" height=\"715\" src=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-17.png?resize=840%2C715&#038;ssl=1\" alt=\"\" class=\"wp-image-488\" srcset=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-17.png?resize=1024%2C872&amp;ssl=1 1024w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-17.png?resize=300%2C255&amp;ssl=1 300w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-17.png?resize=768%2C654&amp;ssl=1 768w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-17.png?w=1482&amp;ssl=1 1482w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><figcaption>A <strong>Shared Action<\/strong> to save email data to a database<\/figcaption><\/figure>\n\n\n\n<p>To configure the program to save to a database, refer to this <a href=\"https:\/\/gearmage.com\/blog\/save-emails-and-attachments-to-a-database\/\">blog post<\/a>. We won&#8217;t show that here.<\/p>\n\n\n\n<p>Now let&#8217;s add this Shared Action to the Global Rules we defined earlier. Multi-select the two rules in the filter tab and then right click and select Add &#8216;Shared Action&#8217; to selected option as shown below. <\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"840\" height=\"637\" src=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-18.png?resize=840%2C637&#038;ssl=1\" alt=\"\" class=\"wp-image-489\" srcset=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-18.png?resize=1024%2C777&amp;ssl=1 1024w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-18.png?resize=300%2C228&amp;ssl=1 300w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-18.png?resize=768%2C583&amp;ssl=1 768w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-18.png?w=1824&amp;ssl=1 1824w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/image-18.png?w=1680&amp;ssl=1 1680w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><figcaption>Add a <strong>Shared Action<\/strong> to selected <strong>Global Rule<\/strong>&#8216;s<\/figcaption><\/figure>\n\n\n\n<p>In the popup that follows, select the shared action we called &#8220;Save emails to a database&#8221; and click OK.<\/p>\n\n\n\n<p>That&#8217;s it. <\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Summary of the final setup for&nbsp;the&nbsp;example<\/strong><\/p><p>Now we have setup rules to process the emails with the Invoice ID in the Subject with the <strong>Email Filter.&nbsp;<\/strong>Then configured <strong>child<\/strong> <strong>Global Rules<\/strong> to save PDF and DOC attachments to different folders. We also defined a <strong>Negative Rule <\/strong>that moves the email to an &#8216;Issues&#8217; folder when no attachment arrives. Lastly, we configured a <strong>Shared Action<\/strong> for the <strong>Global Rules<\/strong> to save the email data to a database.<\/p><cite>Nesting rules are a great way to take advanced actions<\/cite><\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">Nesting actions<\/h3>\n\n\n\n<p>Similarly you can nest actions inside a rule as shown below after saving the attachment.<\/p>\n\n\n\n<p>The below shows how you can unzip a file, do a document conversion and then save to a database and run a command line operation.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"742\" height=\"213\" src=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2016\/05\/unzip_files.jpg?resize=742%2C213&#038;ssl=1\" alt=\"automate email actions: unzip_files\" class=\"wp-image-89\" srcset=\"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2016\/05\/unzip_files.jpg?w=742&amp;ssl=1 742w, https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2016\/05\/unzip_files.jpg?resize=300%2C86&amp;ssl=1 300w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><figcaption>Nest actions inside a <strong>Global Rule<\/strong> or a <strong>Shared Action<\/strong><\/figcaption><\/figure>\n\n\n\n<p>For more on this, read this <a href=\"https:\/\/gearmage.com\/blog\/email-actions-unzip-convert-pdf-run-script\/\">blog post here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Latest builds of v3.2 provides new capabilities such as nesting rules or actions. Make sure you upgrade the build to the latest before you proceed to read through this blog post. This blog post explores how you can nest rules or nest actions like a PRO. Nesting rules Preface &#8211; Processing emails with Global filters &hellip; <a href=\"https:\/\/gearmage.com\/blog\/nesting-email-rules-and-actions\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Nesting email rules and actions&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4,6],"tags":[103,45,49,105,104],"class_list":["post-462","post","type-post","status-publish","format-standard","hentry","category-mad","category-tips","tag-email-actions","tag-email-processing","tag-email-rules","tag-nesting-actions","tag-nesting-rules"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Nesting email rules and actions - Gearmage Blog<\/title>\n<meta name=\"description\" content=\"Automate email related tasks by nesting rules and actions. Perform actions when no rules match or chain actions to process emails in the way you want to.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gearmage.com\/blog\/nesting-email-rules-and-actions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Nesting email rules and actions - Gearmage Blog\" \/>\n<meta property=\"og:description\" content=\"Automate email related tasks by nesting rules and actions. Perform actions when no rules match or chain actions to process emails in the way you want to.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gearmage.com\/blog\/nesting-email-rules-and-actions\/\" \/>\n<meta property=\"og:site_name\" content=\"Gearmage Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-02-18T23:25:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-05T22:49:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/11.-Nesting-rules-types-1024x171.png\" \/>\n<meta name=\"author\" content=\"gearmage\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"gearmage\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/nesting-email-rules-and-actions\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/nesting-email-rules-and-actions\\\/\"},\"author\":{\"name\":\"gearmage\",\"@id\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/#\\\/schema\\\/person\\\/c8728645787bff3555b5873b43161652\"},\"headline\":\"Nesting email rules and actions\",\"datePublished\":\"2019-02-18T23:25:21+00:00\",\"dateModified\":\"2026-02-05T22:49:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/nesting-email-rules-and-actions\\\/\"},\"wordCount\":1355,\"publisher\":{\"@id\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/nesting-email-rules-and-actions\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/02\\\/11.-Nesting-rules-types-1024x171.png\",\"keywords\":[\"email actions\",\"email processing\",\"email rules\",\"nesting actions\",\"nesting rules\"],\"articleSection\":[\"Mail Attachment Downloader\",\"Tips\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/nesting-email-rules-and-actions\\\/\",\"url\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/nesting-email-rules-and-actions\\\/\",\"name\":\"Nesting email rules and actions - Gearmage Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/nesting-email-rules-and-actions\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/nesting-email-rules-and-actions\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/02\\\/11.-Nesting-rules-types-1024x171.png\",\"datePublished\":\"2019-02-18T23:25:21+00:00\",\"dateModified\":\"2026-02-05T22:49:32+00:00\",\"description\":\"Automate email related tasks by nesting rules and actions. Perform actions when no rules match or chain actions to process emails in the way you want to.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/nesting-email-rules-and-actions\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gearmage.com\\\/blog\\\/nesting-email-rules-and-actions\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/nesting-email-rules-and-actions\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/gearmage.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/02\\\/11.-Nesting-rules-types.png?fit=1494%2C250&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/gearmage.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/02\\\/11.-Nesting-rules-types.png?fit=1494%2C250&ssl=1\",\"width\":1494,\"height\":250},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/nesting-email-rules-and-actions\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Nesting email rules and actions\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/\",\"name\":\"Gearmage Blog\",\"description\":\"Email Processing Tools and Solutions\",\"publisher\":{\"@id\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/#organization\",\"name\":\"Gearmage\",\"url\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/gearmage.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/cropped-cropped-GearMage.jpg?fit=240%2C58&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/gearmage.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/02\\\/cropped-cropped-GearMage.jpg?fit=240%2C58&ssl=1\",\"width\":240,\"height\":58,\"caption\":\"Gearmage\"},\"image\":{\"@id\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/#\\\/schema\\\/person\\\/c8728645787bff3555b5873b43161652\",\"name\":\"gearmage\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ca0fad01f9a63241bc21d4f1f44befe7c62e4ee3bb268fb1adaadc2e49ed0699?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ca0fad01f9a63241bc21d4f1f44befe7c62e4ee3bb268fb1adaadc2e49ed0699?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ca0fad01f9a63241bc21d4f1f44befe7c62e4ee3bb268fb1adaadc2e49ed0699?s=96&d=mm&r=g\",\"caption\":\"gearmage\"},\"url\":\"https:\\\/\\\/gearmage.com\\\/blog\\\/author\\\/wp-admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Nesting email rules and actions - Gearmage Blog","description":"Automate email related tasks by nesting rules and actions. Perform actions when no rules match or chain actions to process emails in the way you want to.","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:\/\/gearmage.com\/blog\/nesting-email-rules-and-actions\/","og_locale":"en_US","og_type":"article","og_title":"Nesting email rules and actions - Gearmage Blog","og_description":"Automate email related tasks by nesting rules and actions. Perform actions when no rules match or chain actions to process emails in the way you want to.","og_url":"https:\/\/gearmage.com\/blog\/nesting-email-rules-and-actions\/","og_site_name":"Gearmage Blog","article_published_time":"2019-02-18T23:25:21+00:00","article_modified_time":"2026-02-05T22:49:32+00:00","og_image":[{"url":"https:\/\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/11.-Nesting-rules-types-1024x171.png","type":"","width":"","height":""}],"author":"gearmage","twitter_card":"summary_large_image","twitter_misc":{"Written by":"gearmage","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/gearmage.com\/blog\/nesting-email-rules-and-actions\/#article","isPartOf":{"@id":"https:\/\/gearmage.com\/blog\/nesting-email-rules-and-actions\/"},"author":{"name":"gearmage","@id":"https:\/\/gearmage.com\/blog\/#\/schema\/person\/c8728645787bff3555b5873b43161652"},"headline":"Nesting email rules and actions","datePublished":"2019-02-18T23:25:21+00:00","dateModified":"2026-02-05T22:49:32+00:00","mainEntityOfPage":{"@id":"https:\/\/gearmage.com\/blog\/nesting-email-rules-and-actions\/"},"wordCount":1355,"publisher":{"@id":"https:\/\/gearmage.com\/blog\/#organization"},"image":{"@id":"https:\/\/gearmage.com\/blog\/nesting-email-rules-and-actions\/#primaryimage"},"thumbnailUrl":"https:\/\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/11.-Nesting-rules-types-1024x171.png","keywords":["email actions","email processing","email rules","nesting actions","nesting rules"],"articleSection":["Mail Attachment Downloader","Tips"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/gearmage.com\/blog\/nesting-email-rules-and-actions\/","url":"https:\/\/gearmage.com\/blog\/nesting-email-rules-and-actions\/","name":"Nesting email rules and actions - Gearmage Blog","isPartOf":{"@id":"https:\/\/gearmage.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/gearmage.com\/blog\/nesting-email-rules-and-actions\/#primaryimage"},"image":{"@id":"https:\/\/gearmage.com\/blog\/nesting-email-rules-and-actions\/#primaryimage"},"thumbnailUrl":"https:\/\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/11.-Nesting-rules-types-1024x171.png","datePublished":"2019-02-18T23:25:21+00:00","dateModified":"2026-02-05T22:49:32+00:00","description":"Automate email related tasks by nesting rules and actions. Perform actions when no rules match or chain actions to process emails in the way you want to.","breadcrumb":{"@id":"https:\/\/gearmage.com\/blog\/nesting-email-rules-and-actions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gearmage.com\/blog\/nesting-email-rules-and-actions\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/gearmage.com\/blog\/nesting-email-rules-and-actions\/#primaryimage","url":"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/11.-Nesting-rules-types.png?fit=1494%2C250&ssl=1","contentUrl":"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2019\/02\/11.-Nesting-rules-types.png?fit=1494%2C250&ssl=1","width":1494,"height":250},{"@type":"BreadcrumbList","@id":"https:\/\/gearmage.com\/blog\/nesting-email-rules-and-actions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gearmage.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Nesting email rules and actions"}]},{"@type":"WebSite","@id":"https:\/\/gearmage.com\/blog\/#website","url":"https:\/\/gearmage.com\/blog\/","name":"Gearmage Blog","description":"Email Processing Tools and Solutions","publisher":{"@id":"https:\/\/gearmage.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gearmage.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/gearmage.com\/blog\/#organization","name":"Gearmage","url":"https:\/\/gearmage.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/gearmage.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2016\/02\/cropped-cropped-GearMage.jpg?fit=240%2C58&ssl=1","contentUrl":"https:\/\/i0.wp.com\/gearmage.com\/blog\/wp-content\/uploads\/2016\/02\/cropped-cropped-GearMage.jpg?fit=240%2C58&ssl=1","width":240,"height":58,"caption":"Gearmage"},"image":{"@id":"https:\/\/gearmage.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/gearmage.com\/blog\/#\/schema\/person\/c8728645787bff3555b5873b43161652","name":"gearmage","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ca0fad01f9a63241bc21d4f1f44befe7c62e4ee3bb268fb1adaadc2e49ed0699?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ca0fad01f9a63241bc21d4f1f44befe7c62e4ee3bb268fb1adaadc2e49ed0699?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ca0fad01f9a63241bc21d4f1f44befe7c62e4ee3bb268fb1adaadc2e49ed0699?s=96&d=mm&r=g","caption":"gearmage"},"url":"https:\/\/gearmage.com\/blog\/author\/wp-admin\/"}]}},"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/gearmage.com\/blog\/wp-json\/wp\/v2\/posts\/462","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gearmage.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gearmage.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gearmage.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gearmage.com\/blog\/wp-json\/wp\/v2\/comments?post=462"}],"version-history":[{"count":1,"href":"https:\/\/gearmage.com\/blog\/wp-json\/wp\/v2\/posts\/462\/revisions"}],"predecessor-version":[{"id":917,"href":"https:\/\/gearmage.com\/blog\/wp-json\/wp\/v2\/posts\/462\/revisions\/917"}],"wp:attachment":[{"href":"https:\/\/gearmage.com\/blog\/wp-json\/wp\/v2\/media?parent=462"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gearmage.com\/blog\/wp-json\/wp\/v2\/categories?post=462"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gearmage.com\/blog\/wp-json\/wp\/v2\/tags?post=462"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}