type.inbound
// a pdf icon directly before a current-thread link ending in .pdf
and any(html.xpath(body.html,
'//a[preceding-sibling::*[1][self::img or .//img] or parent::*/preceding-sibling::*[1][self::img or .//img]]'
).nodes,
any(.links,
regex.icontains(.display_text, '[-_.\s]pdf$')
and .href_url.url in map(body.current_thread.links, .href_url.url)
)
and any(html.xpath(.,
'preceding-sibling::*[1]/descendant-or-self::img/@src | parent::*/preceding-sibling::*[1]/descendant-or-self::img/@src'
).nodes,
// an inline (cid) image
any(attachments,
strings.iends_with(..raw,
strings.concat("cid:", .content_id)
)
)
// or office's pdf file-icon (sometimes proxied by gmail)
or strings.icontains(.raw, '/assets/mail/file-icon/png/pdf')
)
)
// no real attachments, only images
and all(attachments, .file_type in $file_types_images)
// self sender
and (
length(recipients.to) == 1
and sender.email.email == recipients.to[0].email.email
)
Playground
Test against your own EMLs or sample data.