1

Topic: How to change the default name when mails are saved under vmail folder

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.4.0
- Deployed with iRedMail Easy or the downloadable installer? No
- Linux/BSD distribution name and version: Debian 10
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL(MariaDB)
- 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.
====

Currently we can see that email files are stored under: /var/vmail/vmail1/domain/p/o/s/postmaster-2021.08.20.06.57.05/Maildir/cur

and file names here are something like
1629444549.M62644P6192.mail.persisl.com,S=3865,W=3941:2,S

What we want to do is to find a way to query the email information on database and then find the related mail file path.

We found table msgs on amavisd database which contains message_id and mail_id, but seems are irreverent to the mail file name.

Is there a way to store the file name (1629444549.M62644P6192.mail.persisl.com,S=3865,W=3941:2,S) to a database table like the msgs table on amavisd db, so we can query that table to monitor any incoming emails?
Or alternatively, is there a way to change the default file name to make it using the message_id or mail_id?

Any help would be appreciated.

Thanks,
Leon

----

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

2

Re: How to change the default name when mails are saved under vmail folder

persisl wrote:

Or alternatively, is there a way to change the default file name to make it using the message_id or mail_id?

No. The file name is handled by Dovecot for better performance of the Maildir mailbox format, do not try to change it at all.

The question is: why do you want to change the file name? Why do you need to know the name?

3

Re: How to change the default name when mails are saved under vmail folder

Currently we are monitoring amavisd database (msgs table) for any incoming mails and pull the email data like From Address/subject/etc. What we need is to get the whole email body as well which is not stored in database. So we are trying to find a way to match the stored mail file name to the record on amdvisd database.

The issue is the mail name doesn't match the message_id/mail_id columns on MariaDB, so we are wondering is it possible to change the mail name. Or the other way, is it possible to store the current mail name on database with all other data like from address/subject/etc.

Do you have any suggestions on how to achieve it?

Many thanks,
Leon

4

Re: How to change the default name when mails are saved under vmail folder

Maybe you should use IMAP service instead, send IMAP command to list unseen (new) messages, then get the mail body with IMAP commands.