Loading...
 

Emails in Unified Index


Managing emails in Tiki is essential for users who want centralized access to their messages. With the addition of the report functionality for available emails, users can now view and manage emails from different folders and IMAP accounts.
The Unified Index in Tiki enhances the capability to manage emails effectively by integrating them into a centralized search. This documentation outlines how to utilize the new feature for reporting on available emails and provides examples for better email management.

Overview of the Feature


The aim of this functionality is to allow users to view the latest messages from specific folders or mailboxes and facilitates the easy movement or copying of these messages to another IMAP mailbox or tracker.

If no specific folder or account is set, the tool defaults to the current user's mailbox accessible via
Copy to clipboard
tiki-webmail.php?page=message_list&list_path=combined_inbox
.

Use Cases

  • Accessing emails from a low-volume mailbox that users may overlook.
  • Tracking unread or flagged emails associated with specific tracker items.

Filtering Options


The filtering mechanism utilizes the syntax available in the PluginList plugin, providing flexible query capabilities. Here are some example queries:

  • Show all unread or flagged emails in a tracker item in category 23.
  • Show all emails less than 30 days old in tracker item 2672 and folder 'abc' of IMAP account 'XYZ'.


The integration with Cypht allows for saved searches to enhance usability.

Display Options


The display feature currently shows just the number of messages, with an option to click for access to detailed views.

DynamicList Usage


DynamicList can be used as a parent filter for sublist queries. It enables the extraction of emails based on specific relationships. The DynamicList should utilize the multivalue search index, allowing values to be stored as multivalues. For example, you can use filters to retrieve related objects by their IDs with the following syntax:

Tiki syntax
Copy to clipboard
{filter field="object_id" content="parent.relationFieldName|object_ids"}

This converts the IDs of related objects into an array, facilitating more precise searching within the search index. For relation fields, you can also use:

Tiki syntax
Copy to clipboard
{filter field="relations" multivalue="tiki.file.attach.invert:trackeritem.object_id|multivalue"}

This allows for searching and matching multivalue items stored in the index.

Example Queries

Here are some examples of Tiki syntax that can be used to leverage this new functionality:

  • 1. Emails attached to a tracker item via a relation field:
Tiki syntax
Copy to clipboard
!!! Emails attached to $$widget1 [item784]$$ via the relation field {LIST()} {filter type="file"} {filter field="email_date" content="NOT "} {filter field="relations" multivalue="tiki.file.attach.invert:trackeritem:784"} {LIST}
  • 2. Unread emails attached to a tracker item:
Tiki syntax
Copy to clipboard
!!! Unread emails attached to $$widget1 [item784]$$ via the relation field {LIST()} {filter type="file"} {filter field="email_date" content="NOT "} {filter field="email_flags" multivalue="NOT Seen"} {filter field="relations" multivalue="tiki.file.attach.invert:trackeritem:784"} {LIST}
  • 3. Emails from the last 30 days from a specific IMAP folder in Cypht:
Tiki syntax
Copy to clipboard
!!! Emails from the last 30 days from a specific IMAP folder in Cypht {LIST()} {filter cypht="example@example.org>INBOX, example@example.org>Sent"} {filter range="email_date" to="now" gap="30 days"} {sort mode="email_date_desc"} {OUTPUT(template=table)} {column label="Subject" field="subject" mode="raw"} {column label="From" field="from" mode="raw"} {column label="Date" field="date"} {OUTPUT} {LIST}

  • 4. Emails in the past 1200 days attached to item784 via relations field:

Tiki syntax
Copy to clipboard
!!! Emails in the past 1200 days attached to [item784] via relations field {LIST()} {filter type="file"} {filter range="email_date" to="now" gap="1200 days"} {filter field="relations" multivalue="tiki.file.attach.invert:trackeritem:784"} {sort mode="email_date_desc"} {OUTPUT(template=table)} {column label="Subject" field="subject" mode="raw"} {column label="From" field="from" mode="raw"} {column label="Date" field="date"} {OUTPUT} {FORMAT(name="subject")}{display name="email_subject" format="objectlink"}{FORMAT} {FORMAT(name="from")}{display name="email_from"}{FORMAT} {FORMAT(name="date")}{display name="email_date" format="datetime"}{FORMAT} {LIST}

  • 5. Emails attached to tracker 4 via sublist:
Tiki syntax
Copy to clipboard
!!! Emails attached to tracker 4 via sublist {LIST()} {filter type="trackeritem"} {filter field="tracker_id" exact="4"} {SUBLIST(name="files" multiple="1" required="1")} {filter field="object_type" exact="file"} {filter field="email_date" content="NOT "} {filter field="relations" multivalue="tiki.file.attach.invert:trackeritem:$parent.object_id|multivalue$"} {SUBLIST} {OUTPUT(tplwiki="Email Report tpl")} {OUTPUT} {LIST}

  • 6. Emails attached to items for category A via sublist:
Tiki syntax
Copy to clipboard
!!! Emails attached to items for category A via sublist {LIST()} {filter type="trackeritem"} {filter categories="30"} {SUBLIST(name="files" multiple="1" required="1")} {filter field="object_type" exact="file"} {filter field="email_date" content="NOT "} {filter field="relations" multivalue="tiki.file.attach.invert:trackeritem:$parent.object_id|multivalue$"} {SUBLIST} {OUTPUT(tplwiki="Email Report tpl")} {OUTPUT} {LIST}


For example, your custom template in the "Email Report tpl" page could look like this:

Using a Wiki page as smarty template
Copy to clipboard
{if $emails|@count > 0}

Email Report

{foreach from=$emails item=email}

{$email.subject}

From: {$email.from}

Date: {$email.date|date_format:"%Y-%m-%d %H:%M:%S"}

Body: {$email.body}


{/foreach}
{else}

No emails found.

{/if}

  • 7. Emails from the last 30 days from a specific IMAP folder(s) in Cypht:
Tiki syntax
Copy to clipboard
!!! Emails from the last 30 days from a specific IMAP folder(s) in Cypht {LIST()} {filter cypht="example@example.org>INBOX, example@example.org>Sent"} {filter range="email_date" to="now" gap="30 days"} {filter field="email_flags" multivalue="Seen"} {sort mode="email_date_desc"} {OUTPUT(template=table)} {column label="Subject" field="subject" mode="raw"} {column label="From" field="from" mode="raw"} {column label="Date" field="date"} {OUTPUT} {FORMAT(name="subject")}{display name="email_subject" format="objectlink"}{FORMAT} {FORMAT(name="from")}{display name="email_from"}{FORMAT} {FORMAT(name="date")}{display name="email_date" format="datetime"}{FORMAT} {LIST}

  • 8. Emails from the last 30 days from a special folder in Cypht:
Tiki syntax
Copy to clipboard
!!! Emails from the last 30 days from a special folder in Cypht {LIST()} {filter cypht="Everything"} {filter range="email_date" to="now" gap="30 days"} {sort mode="email_date_desc"} {OUTPUT(template=table)} {column label="Subject" field="subject" mode="raw"} {column label="From" field="from" mode="raw"} {column label="Date" field="date"} {OUTPUT} {FORMAT(name="subject")}{display name="email_subject" format="objectlink"}{FORMAT} {FORMAT(name="from")}{display name="email_from"}{FORMAT} {FORMAT(name="date")}{display name="email_date" format="datetime"}{FORMAT} {LIST}


A special thanks to Victor Emanouilov for the code examples provided.

With the addition of the report functionality for available emails, Tiki users can now manage their emails more efficiently and organized. This not only enhances the user experience but also facilitates the integration of emails into existing workflows.

List Slides