type.inbound
and any(body.links,
.href_url.domain.domain == "mailtrack.ksd.or.kr"
and .href_url.path == "/TMS/tracking"
and "url" in~ keys(.href_url.query_params_decoded)
and not any(regex.iextract(.href_url.query_params,
'url=([^&]+)(?:\&|\/|$)'
),
strings.parse_url(.groups[0]).domain.root_domain == ..href_url.domain.root_domain
)
)
Playground
Test against your own EMLs or sample data.