1

Topic: Multiple mail domain creation

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

Hi!
Am I right when I think there is no easier way to create multiple mail domains than using commandline.I have no problem with it but a client asked if we could run a mail server for him that he could run himself. But he has not the skills to create maildomains using ssh and I assume that is the only way even if you have the PRO version

Regards

Anders Yuran

----

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

2 (edited by Cthulhu 2024-09-24 05:05:22)

Re: Multiple mail domain creation

i mean, you can easly create some shellscripts for that

personally, i use the following scripts to generate SQL code for generating a simple mailbox:

#!/usr/bin/env bash

STORAGE_BASE_DIRECTORY="/var/vmail/vmail1"
STORAGE_BASE="$(dirname ${STORAGE_BASE_DIRECTORY})"
STORAGE_NODE="$(basename ${STORAGE_BASE_DIRECTORY})"
DEFAULT_QUOTA='1024'
DATE="$(date +%d.%m.%Y)"

if [ X"$#" != X'2' ]; then
    echo "Invalid arguments"
    echo "bash ./addmailbox.sh user@domain.tld password"
    exit 255
fi

# Read input
mail="$1"
password="$2"

# Calc Storage Dirs
username="$(echo ${mail,,} | awk -F'@' '{print $1}')"
domain="$(echo ${mail,,} | awk -F'@' '{print $2}')"
maildir="${domain,,}/${username^}-${DATE}/"

#Crypt Password
CRYPT_PASSWD="$(doveadm pw -s 'ssha512' -p ${password})"

cat <<EOF


INSERT INTO mailbox (username, password, name, storagebasedirectory, storagenode, maildir, quota, domain, active, passwordlastchange, created) VALUES ('${mail,,}', '${CRYPT_PASSWD}', '${username^}', '${STORAGE_BASE}','${STORAGE_NODE}', '${maildir}', '${DEFAULT_QUOTA}', '${domain}', '1', NOW(), NOW());


INSERT INTO forwardings (address, forwarding, domain, dest_domain, is_forwarding) VALUES ('${mail,,}', '${mail,,}','${domain,,}', '${domain,,}', 1);
EOF