--- title: "Email script examples" slug: "email-script-examples" updated: 2026-07-23T10:06:46Z published: 2026-07-23T10:06:46Z canonical: "help.8x8.com/email-script-examples" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.8x8.com/llms.txt > Use this file to discover all available pages before exploring further. # Email script examples An **8x8 Contact Center** email script uses the information contained in an email message to route the message to one or more email queues. Use **8x8 Configuration Manager** to create email scripts. The following procedure illustrates how to combine **8x8 Contact Center** email script objects with script object control flow features: - [Delete email messages that contain viruses](/documentation/docs/content-email-script-examples#delete-email-messages-that-contain-viruses). - [Inspect an email message subject line](/documentation/docs/content-email-script-examples#inspect-an-email-message-subject-line). - [Route email messages to queues](/documentation/docs/content-email-script-examples#route-email-messages-to-queues). - [Insert stop processing objects into email scripts](/documentation/docs/content-email-script-examples#insert-stop-processing-in-email-scripts). - [Enable an email channel](/documentation/docs/content-email-script-examples#enable-an-email-channel). ## Before you begin The procedure in this section assumes that you have used **8x8 Configuration Manager** to create at least one email queue. For details on creating email queues, refer to [Create Email Queues](/documentation/docs/create-email-queues). > [!NOTE] > Best Practice: > > Before editing a **8x8 Contact Center** script, disable the email channel. **To disable the email channel:** 1. From the **Configuration Menu**, open **Channels**. 2. Go to the **Email** tab. 3. Find the desired channel, and click ![](https://cdn.us.document360.io/e3a59e39-abd3-4423-964c-0a4008dc5673/Images/Documentation/icon_edit_18x18.png?sv=2026-02-06&spr=https&st=2026-11-03T22%3A38%3A02Z&se=2026-11-03T23%3A38%3A02Z&sr=c&sp=r&sig=XdPClKZvsyFPinO2mvmGBRSdcvIBcmRT%2FWFfpeiiURM%3D). 4. In the **Properties** tab, clear **This channel is enabled**. 5. Click **Save**. For details on email channels properties, refer to [Configure Email Channel Properties](/documentation/docs/configure-email-channel-properties). ## Delete Email Messages that Contain Viruses If your email server does not provide protection against email viruses, include the Check Virus script object at the top of all your email scripts to help protect your contact center from malicious email messages. > [!NOTE] > Note: > > If your server already protects against email viruses, do not use the Check Virus object. **To inspect the email messages for viruses:** 1. From the **Configuration Menu**, open **Scripts**. 2. Go to the **Email** tab. 3. Find the desired script, and click ![](https://cdn.us.document360.io/e3a59e39-abd3-4423-964c-0a4008dc5673/Images/Documentation/icon_edit_18x18.png?sv=2026-02-06&spr=https&st=2026-11-03T22%3A38%3A02Z&se=2026-11-03T23%3A38%3A02Z&sr=c&sp=r&sig=XdPClKZvsyFPinO2mvmGBRSdcvIBcmRT%2FWFfpeiiURM%3D). 4. In the **Script** tab, click **Email Routing**, then click **[add]**. 5. In the Insert object selection list, select **Check Virus**. 6. Enter an **Object tag**, such as , and click **OK**. **8x8 Configuration Manager** adds the Check Virus script object to the script. The Check Virus script object contains the exit points labeled **infected** and **not Infected**. 7. Delete any email messages infected by viruses: 1. Under the **Check Virus** script object, click **[add]** next to **infected**. 2. In the Insert object selection list, select **Delete Email**. 3. Enter an Object tag, such as , then click **OK**. Use the same script design principles to incorporate the Check Spam and Check Flood objects into an email script. ## Inspect an Email Message Subject Line Use the Check Subject in the email script to inspect the subject line of incoming email messages for a particular string. **To inspect an email message's subject line:** 1. In the above example, click **[add]** next to **not infected**. 2. In the script object selection list, select **Check Subject**. 3. Enter an Object tag, such as . 4. In the **Select Operator** list, choose **Contains**. 5. In the **Pattern** text entry area, type . 6. Clear **Use pattern as a POSIX extended regular expression** and **Negate comparison**. 7. Select **Case Sensitive**. 8. Click **OK**. **8x8 Configuration Manager** inserts the Check Subject script object below **not infected**. ![](https://cdn.us.document360.io/e3a59e39-abd3-4423-964c-0a4008dc5673/Images/Documentation/cfgmgrchannelsemailscriptchecksubject01.png?sv=2026-02-06&spr=https&st=2026-11-03T22%3A38%3A02Z&se=2026-11-03T23%3A38%3A02Z&sr=c&sp=r&sig=XdPClKZvsyFPinO2mvmGBRSdcvIBcmRT%2FWFfpeiiURM%3D) ## Route Email Messages to Queues Use the comparison results returned by the Check Subject to route email messages. **To use the results Check Subject to route the message:** 1. Delete email messages that contain a certain string, such as , in the subject area. 1. Under Check Subject, click **[add]** next to **matched**. 2. Select **Delete Email** from the Insert object list. 3. Enter an object tag, such as , then click **OK**. The email script deletes all incoming email messages that contain in the subject line. 2. For all messages that do not contain in the subject area, route the message to an email queue. 1. Under Check Subject, click **[add]** next to **not matched**. 2. Select **Forward to queue** from the Insert object list. 3. Enter an object tag, such as . 4. In the **Select Queue** list, choose an email queue. 5. In **Maximum number of emails waiting**, type <100>, and click **OK**. ![](https://cdn.us.document360.io/e3a59e39-abd3-4423-964c-0a4008dc5673/Images/Documentation/cfgmgrchannelsemailscriptforwardtoqueue01.png?sv=2026-02-06&spr=https&st=2026-11-03T22%3A38%3A02Z&se=2026-11-03T23%3A38%3A02Z&sr=c&sp=r&sig=XdPClKZvsyFPinO2mvmGBRSdcvIBcmRT%2FWFfpeiiURM%3D) 3. If the message does not exceed the value specified by Maximum number of emails waiting, then stop script processing: 1. Under Forward to queue, click **[add]** next to **routed**. 2. Select **Stop processing** from the Insert object list. 3. Enter an Object tag, and click **OK**. After routing the message, the script stops. 4. If the message exceeds the value specified by Maximum number of emails waiting (in the email queue), then send the email to an overload queue: 1. Under Forward to queue, click **[add]** next to **overload**. 2. Select **Forward to Queue** from the Insert object list. 3. Enter an Object tag. 4. Enter the **Maximum number of emails waiting**. 5. Click **OK**. Use the Forward to Queue script object to specify a secondary email queue that receives messages that exceed the primary queue's Maximum number of emails waiting setting. 6. Click to **Save** your script. ## Insert Stop Processing in Email Scripts The procedure discussed in [Route Email Messages to Queues](/documentation/docs/content-email-script-examples#routing) illustrates the use of the Stop processing email script object to end the operation of an email script. Insert Stop processing objects at all points where you intend the script to stop. Doing so ensures that the script always behaves as designed. ## Enable an Email Channel Perform the procedure in this section to enable an email channel, and run the channel's email script. **To enable the email channel:** 1. From the **Configuration Menu**, open **Channels**. 2. Go to the **Email** tab. 3. Find the desired script, and click ![](https://cdn.us.document360.io/e3a59e39-abd3-4423-964c-0a4008dc5673/Images/Documentation/icon_edit_18x18.png?sv=2026-02-06&spr=https&st=2026-11-03T22%3A38%3A02Z&se=2026-11-03T23%3A38%3A02Z&sr=c&sp=r&sig=XdPClKZvsyFPinO2mvmGBRSdcvIBcmRT%2FWFfpeiiURM%3D). 4. In the **Properties** tab, select **This channel is enabled**. 5. Click **Save**. The **8x8 Contact Center** puts the email channel and associated script into service. You can now send test messages to the email channel to validate the operation of the script. For details on email channel properties, refer to [Configure Email Channel Properties](/documentation/docs/content-configure-email-channel-properties).