Topic: Record outgoing message ID possible?

- iRedMail version (check /etc/iredmail-release): v0.9.5-1
- Deployed with iRedMail Easy or the downloadable installer? No idea
- Linux/BSD distribution name and version: CentOS 7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro? v2.4.0

Not really an iRedmail issue, but maybe someone here can help me out.

One of our clients with the above iRedmail platform has a need to be able to look up outgoing email header information (sender, receipient, timestamp) by message ID.

The postfix log has something like

/var/log/maillog:Mar  7 15:33:59 mail2 postfix/smtp[9757]: F2F7730E9097: to=<test@example.org>, delay=0.48, delays=0.05/0.01/0.17/0.25, dsn=2.0.0, status=sent (250 OK queued as 5846ab14-6a7b-498c-b482-402666fc20b1)

for outgoing email, and I need to be able to lookup using the ID "5846ab14-6a7b-498c-b482-402666fc20b1" which it the only information we get back from an external processing service.

Is this stored somewhere in iRedMail? Or can postfix be told to store it somehere? I don't want to have to grep the mail logs if I can avoid it.


Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team.

2 (edited by Cthulhu 2022-03-08 22:09:46)

Re: Record outgoing message ID possible?

the amavis database contains a table called "msgs", every mail is listed there includeing mailid message id, and if it was origination (sent) or received

if you only get the message_id, you can do a like search, for example:

SELECT * FROM amavisd.msgs WHERE amavisd.msgs.message_id LIKE "%bd8b3d0e-abe7-904d-20aa-0793d6a9897c%";

the result contains: timestamp, from, to, and subject and i think that was everything you were looking for