{"id":6104,"date":"2023-05-02T13:59:47","date_gmt":"2023-05-02T17:59:47","guid":{"rendered":"https:\/\/batchpatch.com\/?p=6104"},"modified":"2023-05-02T14:00:06","modified_gmt":"2023-05-02T18:00:06","slug":"batchpatch-custom-email-notifications","status":"publish","type":"post","link":"https:\/\/batchpatch.com\/batchpatch-custom-email-notifications","title":{"rendered":"BatchPatch Custom Email Notifications"},"content":{"rendered":"<p>Recently someone asked if it&#8217;s possible to configure BatchPatch to send an email notification 15 minutes before the patching maintenance begins.  Here is how to do it:<\/p>\n<ol>\n<li>If you haven&#8217;t already done so, you&#8217;ll need to configure the outgoing email account details under <em>Tools > Settings > Email Notifications<\/em><br \/>\n<a href=\"\/wp-content\/uploads\/2023\/05\/2023-05-02-13_42_35.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2023\/05\/2023-05-02-13_42_35.png\" alt=\"\" width=\"648\" height=\"641\" class=\"aligncenter size-full wp-image-6105\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2023\/05\/2023-05-02-13_42_35.png 648w, https:\/\/batchpatch.com\/wp-content\/uploads\/2023\/05\/2023-05-02-13_42_35-300x297.png 300w\" sizes=\"auto, (max-width: 648px) 100vw, 648px\" \/><\/a>\n<\/li>\n<p><\/p>\n<li>Next, setup a custom email notification by clicking on <em>Actions > Email notification > Create\/modify email notifications<\/em>.  Fill out the fields, as desired.  If you put $grid into the attachment field, a copy of the grid will be included as an attachment on the email.  Click the double-right arrow to save the notification.<br \/>\n<a href=\"\/wp-content\/uploads\/2023\/05\/2023-05-02-13_46_17.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2023\/05\/2023-05-02-13_46_17.png\" alt=\"\" width=\"743\" height=\"462\" class=\"aligncenter size-full wp-image-6106\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2023\/05\/2023-05-02-13_46_17.png 743w, https:\/\/batchpatch.com\/wp-content\/uploads\/2023\/05\/2023-05-02-13_46_17-300x187.png 300w\" sizes=\"auto, (max-width: 743px) 100vw, 743px\" \/><\/a>\n<\/li>\n<p><\/p>\n<li>Now you can setup your scheduled task to run at the desired time (15 minutes before the maintenance) to send out the custom email notification that you created in the previous step.  Alternatively you could add the email notification to a job queue, if desired.  However, in this example I&#8217;ve created a &#8220;dummy&#8221; row in the grid that serves no purpose except to send the email notification as a scheduled task.  I select it and then click <em>Actions > Task scheduler > Create\/modify scheduled task<\/em><br \/>\n<a href=\"\/wp-content\/uploads\/2023\/05\/2023-05-02-13_50_11.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2023\/05\/2023-05-02-13_50_11.png\" alt=\"\" width=\"884\" height=\"752\" class=\"aligncenter size-full wp-image-6107\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2023\/05\/2023-05-02-13_50_11.png 884w, https:\/\/batchpatch.com\/wp-content\/uploads\/2023\/05\/2023-05-02-13_50_11-300x255.png 300w, https:\/\/batchpatch.com\/wp-content\/uploads\/2023\/05\/2023-05-02-13_50_11-768x653.png 768w\" sizes=\"auto, (max-width: 884px) 100vw, 884px\" \/><\/a>\n<\/li>\n<p><\/p>\n<li>In the Task drop-down I can now find and select the custom email notification that I created earlier.<br \/>\n<a href=\"\/wp-content\/uploads\/2023\/05\/2023-05-02-13_51_39.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2023\/05\/2023-05-02-13_51_39.png\" alt=\"\" width=\"651\" height=\"503\" class=\"aligncenter size-full wp-image-6108\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2023\/05\/2023-05-02-13_51_39.png 651w, https:\/\/batchpatch.com\/wp-content\/uploads\/2023\/05\/2023-05-02-13_51_39-300x232.png 300w\" sizes=\"auto, (max-width: 651px) 100vw, 651px\" \/><\/a>\n<\/li>\n<p><\/p>\n<li>Next set the desired run date and time.  Then click OK.<br \/>\n<a href=\"\/wp-content\/uploads\/2023\/05\/2023-05-02-13_53_57.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2023\/05\/2023-05-02-13_53_57.png\" alt=\"\" width=\"648\" height=\"410\" class=\"aligncenter size-full wp-image-6109\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2023\/05\/2023-05-02-13_53_57.png 648w, https:\/\/batchpatch.com\/wp-content\/uploads\/2023\/05\/2023-05-02-13_53_57-300x190.png 300w\" sizes=\"auto, (max-width: 648px) 100vw, 648px\" \/><\/a>\n<\/li>\n<p><\/p>\n<li>Lastly, since this will run as a scheduled task, I need to make sure to enable the task scheduler by clicking the red timer\/clock icon in the upper right corner of the BatchPatch window so that it turns green, which means it&#8217;s enabled.  Alternatively, if you have the BatchPatch service instance installed\/running, then you can just save the grid and send it to the BatchPatch service instance where the scheduler is always running.<br \/>\n<a href=\"\/wp-content\/uploads\/2023\/05\/2023-05-02-13_56_32.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2023\/05\/2023-05-02-13_56_32.png\" alt=\"\" width=\"748\" height=\"410\" class=\"aligncenter size-full wp-image-6110\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2023\/05\/2023-05-02-13_56_32.png 748w, https:\/\/batchpatch.com\/wp-content\/uploads\/2023\/05\/2023-05-02-13_56_32-300x164.png 300w\" sizes=\"auto, (max-width: 748px) 100vw, 748px\" \/><\/a>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Recently someone asked if it&#8217;s possible to configure BatchPatch to send an email notification 15 minutes before the patching maintenance begins. Here is how to do it: If you haven&#8217;t already done so, you&#8217;ll need to configure the outgoing email account details under Tools > Settings > Email Notifications Next, setup a custom email notification [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1,17,3],"tags":[39,197],"class_list":["post-6104","post","type-post","status-publish","format-standard","hentry","category-blog","category-general","category-tutorials","tag-email-notifications","tag-task-scheduler"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/posts\/6104","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/comments?post=6104"}],"version-history":[{"count":3,"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/posts\/6104\/revisions"}],"predecessor-version":[{"id":6113,"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/posts\/6104\/revisions\/6113"}],"wp:attachment":[{"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/media?parent=6104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/categories?post=6104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/tags?post=6104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}