Rules will still work with scripts but you need to change a registry entry. If the value name is missing, you will have to create it.
Registry value.
Key: HKEY_CURRENT_USER\Software\Microsoft\Office\<version>\Outlook\Security
Value name: EnableUnsafeClientMailRules
Value type: REG_DWORD
Value: 1
where <version> is the Office version number e.g. 16.0
If you are not comfortable editing the registry, the following macro will effect the change
Sub ToggleOutlookScripts()
Dim wshShell As Object
Dim RegKey As String
Dim rKeyWord As String
Dim wVer As String
Set wshShell = CreateObject("WScript.Shell")
wVer = Val(Application.Version) & ".0"
Start:
RegKey = "HKEY_CURRENT_USER\Software\Microsoft\Office\" & wVer & "\Outlook\Security\"
On Error Resume Next
'The registry key does not exist
rKeyWord = wshShell.RegRead(RegKey & "EnableUnsafeClientMailRules")
If rKeyWord = "" Then
wshShell.RegWrite RegKey & "EnableUnsafeClientMailRules", 1, "REG_DWORD" 'set it at zero
GoTo Start: 'and read it again
End If
If rKeyWord = 1 Then
wshShell.RegWrite RegKey & "EnableUnsafeClientMailRules", 0, "REG_DWORD"
MsgBox "Unsafe Client Mail Rules disabled", vbInformation, "Scripts"
Else
wshShell.RegWrite RegKey & "EnableUnsafeClientMailRules", 1, "REG_DWORD"
MsgBox "Unsafe Client Mail Rules enabled", vbInformation, "Scripts"
End If
lbl_Exit:
Exit Sub
End Sub