1

Topic: Customize maildir path with domain

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

I really appreciate the hashed style that iRedMail creates the maildir of email accounts, this makes it much easier to find the maildir, but in our scenario we have thousands of domains (around 5,000) so having all these folders inside /var /vmail/vmail1 would end up causing the problem of slowness in listing everyone. To get around this, I customized the create_mail_user_SQL.sh script within /tools and made the domain creation in Hashed style, for example:

domain: domain.tld
user: test@domain.tld

maildir path:

/var/vmail/vmail1/d/o/domain.tld/t/e/test-2024.02.16.14.50.34

I also adjusted the script so that it only used the first 2 characters instead of 3. This was very good for the migration I carried out. However, when creating an account through the iRedAdmin panel, it does not use the domain hashed style and ends up creating the folder in /var/vmail/vmail1

Does iRedMail allow me to choose to use hashed style for the domain as well? and choose how many characters to use?

----

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

2

Re: Customize maildir path with domain

daemonadmin wrote:

Does iRedMail allow me to choose to use hashed style for the domain as well? and choose how many characters to use?

iRedAdmin-Pro doesn't support this yet, i can implement this in iRedAdmin-Pro if you want.

How many characters do you prefer? 2 or 3? I guess 2 is enough?

3

Re: Customize maildir path with domain

Hi Zhang,

That would be really nice. 2 characters for the domain would be enough, and if possible choose 2 characters for the email account so the maildir path is not so long

4

Re: Customize maildir path with domain

Already implemented hash domain in latest development edition of iRedAdmin-Pro and iRedAdmin. You can use this patch (it applies to both iRedAdmin-Pro and iRedAdmin) if you want to give it a try:
https://github.com/iredmail/iRedAdmin/c … 8d340810f2

New parameter "MAILDIR_DOMAIN_HASHED" is introduced with this commit, defaults to False.

# Avoid too many folders (domain name) in same directory (/var/vmail/vmail1/).
# Useful if server hosts email domains.
#   - With hash: d/o/domain.com/...
#   - Without: domain.com/...
MAILDIR_DOMAIN_HASHED = False

You should copy this parameter and set it to True in file /opt/www/iredadmin/settings.py, then restart "iredadmin" service.

5

Re: Customize maildir path with domain

Hi Zhang

I applied the commit to the libs/iredutils.py file and added the "MAILDIR_DOMAIN_HASHED = True" parameter in settings.py, restarted the iredadmin service. However, when creating a new user, the message: "Internal Server Error" is displayed.

I am using version iRedAdmin-Pro-SQL-5.5

Is there any file or log that I can forward to you to analyze why this error is happening to me?

6

Re: Customize maildir path with domain

Sorry about the delay.
Fixed moment ago, tested locally and works fine. Please let me know how it works for you.
https://github.com/iredmail/iRedAdmin/c … e05c2be813

7

Re: Customize maildir path with domain

Hi Zhang

The creation of the new user worked as expected, but after applying the commit, the "Dashboard" menu shows the error: "Internal Server Error", it does not load, other menus are ok

8

Re: Customize maildir path with domain

Hi Zhang,

Was it possible to verify this problem in the dashboard menu that presents an error?

9

Re: Customize maildir path with domain

Hi @daemonadmin,

These 2 changes doesn't impact Dashboard page at all, i wonder whether you can extract some error log from /var/log/* for me for troubleshooting.

10

Re: Customize maildir path with domain

Hi @daemonadmin,

I cannot reproduce the "500 internal server error" on Dashboard page with both iRedAdmin and iRedAdmin-Pro.

Can you still steadily reproduce it? Contact me if it's ok to offer remote ssh access with root privilege: https://www.iredmail.org/contact.html