mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2025-04-04 00:17:06 +00:00
This adds a new section to the admin panel called "Activity", that supplies charts, graphs and details about messages entering and leaving the host. A new daemon captures details of system mail activity by monitoring the /var/log/mail.log file, summarizing it into a sqllite database that's kept in user-data.
13 lines
385 B
SQL
13 lines
385 B
SQL
--
|
|
-- top 10 users receiving the most spam
|
|
--
|
|
SELECT rcpt_to, count(*) AS count FROM mta_delivery
|
|
JOIN mta_accept ON mta_accept.mta_accept_id = mta_delivery.mta_accept_id
|
|
JOIN mta_connection ON mta_accept.mta_conn_id = mta_connection.mta_conn_id
|
|
WHERE spam_result='spam' AND
|
|
connect_time >= :start_date AND
|
|
connect_time < :end_date
|
|
GROUP BY rcpt_to
|
|
ORDER BY count(*) DESC
|
|
LIMIT 10
|