1

Topic: Log or Report with email sent

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.6.2
- Deployed with iRedMail Easy or the downloadable installer? installer
- Linux/BSD distribution name and version: Ubuntu 20.04.2 LTS
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hi,

I would like to see a log or report with all the emails sent in the day through my iRedMail server. It's possible? As?

Thx

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Log or Report with email sent

iRedAPD stores very basic info of outbound smtp session in SQL table "iredapd.smtp_sessions", you can grab it with SQL command line tool or scripting.

With iRedAdmin-Pro, you can check the smtp session from "System -> SMTP Sessions".

3 (edited by bnobre 2022-11-08 20:14:44)

Re: Log or Report with email sent

Cool... The time in the table records is wrong, it is 3 hours ahead. How to fix?

Another thing... I also needed to know the "Subject" and the "Attachment". It's possible?

4 (edited by mounty 2023-07-31 05:53:04)

Re: Log or Report with email sent

ZhangHuangbin wrote:

iRedAPD stores very basic info of outbound smtp session in SQL table "iredapd.smtp_sessions", you can grab it with SQL command line tool or scripting.

With iRedAdmin-Pro, you can check the smtp session from "System -> SMTP Sessions".

We've been running an iRedMail installation for about six months with many 1000s of emails sent.  System -> SMTP Sessions shows 2649 emails sent in the last three days.

Nevertheless, `select * from iredapd.smtp_sessions` returns 0 rows.  Not an error, but 0 rows.  Has the implementation recently changed?

Please state how we can obtain, programmatically, a list of sent emails.

5

Re: Log or Report with email sent

mounty wrote:

Please state how we can obtain, programmatically, a list of sent emails.

The answer is in lib/amavisd/log.py:

SELECT msgs.mail_id, msgs.subject, to_timestamp(msgs.time_num), msgs.size, msgs.spam_level, msgs.client_addr, msgs.policy, sender.email_raw AS sender_email, recip.email_raw AS recipient FROM msgs LEFT JOIN msgrcpt ON (msgs.mail_id = msgrcpt.mail_id) LEFT JOIN maddr AS sender ON (msgs.sid = sender.id) LEFT JOIN maddr AS recip ON (msgrcpt.rid = recip.id) WHERE msgs.quar_type <> 'Q' ORDER BY msgs.time_num DESC;