Just started looking at feasibility of writing it myself using the API.
As you loop through each domain and each user (not shown), you would need to use this query to find applicable messages, setting the current account into the "ownerEmailAddress: field. I think I would limit search to Inbox folder for performance reasons.
I have attempted to elaborate on the sketchy documentation by inserting possible values for lists and dictionaries, using Python syntax: {} for dicitionaries and [] for lists. Several of the options would not apply to this type of search (CategoryFilter,skip,take,selectedUIDs)
What I don't understand is how to use the "query" parameter, as it seems redundant. Can someone explain that item, or generally help with ensuring that the syntax is correct on first try?
Doug
response.post(
url=Base+"api/v1/mail/messages"
, auth="value"
,json=
{
"query": text,
"includeSubFolders": False,
"fieldsToSearch": (
"None",
"From",
"To",
"Subject",
"Body",
"Date",
"Cc",
"Header",
"Uid",
"Bcc"
),
"searchFieldValueMap": {
"From": "value",
"To": "value",
"Subject" : "value",
"Body" : "value",
"Date" : "value",
"Cc" : "value",
"Header" : "value",
"Uid" : "value",
"Bcc" : "value",
},
# Note that values should only be supplied for fields that are in the FieldsToSearch list
"searchFlags": {
"Read" : False,
"Replied" : False,
"Forwarded" : False,
"Deleted" : False,
"Flagged" : False,
"Draft" : False,
"Recent" : False,
"hasAttachment" : False,
"linkedToTask"" : False
},
"messagesSince": date,
"messagesBefore": date,
"maxSizeInBytes": number,
"minSizeInBytes": number,
"useContentFieldOnly": boolean,
"experimentalSpeedup": boolean,
"oR": boolean,
"categoryFilter": {
"filteredCategories": [ text ... ],
"includeNoCategory": boolean
},
"ownerEmailAddress": text, // An identifier for the person sharing the item.
"folder" : "Inbox", // The name of the folder.
"skip": 0, // The starting index for the data items being requested.
"take": number, // Total count of emails being requested.
"selectedIds": [ number ... ] , // A list of email UIDs that are currently selected.
"sortType": (
"Date",
"Size",
"Subject",
"From",
"To",
"InternalDate",
"Attachment"
), // The sorting filter that should be applied.
"sortAscending": boolean// Flag used to determine if a list should be ascending or descending order.
}
)