Need mysql query for get particular user mail count.

Issue #1314 closed
B.JEGADEESAN created an issue

Hi,

We need mysql query for get particular ldap user mail count from mysql database with particular timestamp.

For Ex: user1@example.com overall archive mail count from 01.05.2023 to 31.05.2023.

Please let us know how to achieve this.

Comments (5)

  1. Janos SUTO repo owner

    I suggest you to write a query on the v_messages view. It contains both the sender and recipient addresses. First, you need to gather all the email addresses for this user, then run a select using the date range, and be sure to use DISTINCT in the select statement to exclude any duplicate rows.

  2. B.JEGADEESAN reporter

    Thanks for your suggestion and i am tried the below mysql query and we got the expected data output.

    MariaDB [piler]> SELECT id, from, to FROM v_messages WHERE sent >= 1690828201 AND sent <= 1694456999 AND from = 'testuser1@example.com';

  3. Janos SUTO repo owner

    Great, however, note that this query counts only the emails sent by this user, not what he received.

  4. Log in to comment