def rule(event):
    if all(
        [
            event.deep_get("DestinationPort", default="") in [25, 587, 465, 2525],
            event.deep_get("Initiated", default="") == "true",
            not any(
                [
                    any(
                        [
                            event.deep_get("Image", default="").endswith("\\thunderbird.exe"),
                            event.deep_get("Image", default="").endswith("\\outlook.exe"),
                        ]
                    ),
                    event.deep_get("Image", default="").startswith(
                        "C:\\Program Files\\Microsoft\\Exchange Server\\"
                    ),
                    all(
                        [
                            event.deep_get("Image", default="").startswith(
                                "C:\\Program Files\\WindowsApps\\microsoft.windowscommunicationsapps_"
                            ),
                            event.deep_get("Image", default="").endswith("\\HxTsr.exe"),
                        ]
                    ),
                ]
            ),
        ]
    ):
        return True
    return False
