Smart Actions not getting processed on emails coming from Exchange Online, after moving from On-premises Exchange

This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice. This article is not considered official documentation for K2 software and is provided "as is" with no warranties.
LEGACY/ARCHIVED CONTENT
This article has been archived, and/or refers to legacy products, components or features. The content in this article is offered "as is" and will no longer be updated. Archived content is provided for reference purposes only. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.

Issue

Smart action replies are not working and are not actioned on as expected. Worklist items on K2 Workspace are not updated or actioned.

Symptoms

After moving On-premises Exchange mailboxes to Exchange Online mailboxes, Smart actions are not working and are being picked up by the K2 Service mailbox as Spam and cannot be processed.

This was identified by applying debugging and the below errors were presented:

Logs
OnMessageReceived Start
OnMessageReceived tmp SPAM!
OnMessageReceived done

Resolution

To resolve this issue, add the entries below in the K2HostServer.exe.config, and restart the K2 Blackpearl service:

<system self="K2:Domain\ServiceAccount" enableListeners="true" allowAmbiguity="true">

        <security spamSecurity="Off"> <!-- Default is InternalMail. -->
    </security>
</system>

K2 Documentation on Spam security: https://help.k2.com/onlinehelp/k2blackpearl/icg/4.7/default.htm#Configure/bp_Smartactions.htm