type.inbound
and (
strings.ilike(sender.display_name, '*enbridge*')
or strings.ilike(sender.email.domain.domain, '*enbridge*')
or strings.ilike(subject.subject, '*enbridge*')
)
and any(body.links,
strings.ilike(.display_text, "*pay now*", "*view your bill*")
)
// negate replies
and (length(headers.references) == 0 or headers.in_reply_to is null)
and sender.email.domain.root_domain not in~ (
'enbridge.com',
'enbridgegas.com',
// Enbridge Subsidiaries
'domenergyoheb.com', // Dominion Energy Ohio
'domenergyuteb.com' // Dominion Energy Utah
)
Playground
Test against your own EMLs or sample data.