Type: MSSQL
Description: This query returns email records for a contact that have keywords in the body of the email. In the example below we are looking for emails that contain the words “Subscription”, “Offering”, “Document ” or “Documents “. Notice the trailing space after the document and documents examples.
SELECT
c1.contact
,c1.company
,mb.maildate
,mb.mailref
,c1.accountno
FROM
contact1 c1
JOIN conthist ch (NOLOCK)
ON c1.accountno=ch.accountno
JOIN mailbox mb
ON ch.recid = mb.linkrecid
WHERE
mb.rfc822 LIKE '%type keywords between percent signs like examples below%'
AND (mb.rfc822 LIKE '%Subscription%'
OR mb.rfc822 LIKE '%Offering%')
AND (mb.rfc822 LIKE '%Document %'
OR mb.rfc822 LIKE '%Documents %')
AND mb.folder = 'Filed'
GROUP BY
c1.contact
,c1.company
,mb.maildate
,mb.mailref
,c1.accountno
Bookmark:
These icons link to social bookmarking sites where readers can share and discover new web pages.