renamed virtual_users to virtual_mailboxes

This commit is contained in:
Christoph Haas 2025-08-22 00:56:30 +02:00
parent c70bd7cd0f
commit ea7cd9a612
4 changed files with 20 additions and 19 deletions

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before After
Before After

View file

@ -29,6 +29,7 @@ organisation. So I replaced resource-hungry components by more lightweight softw
of RAM wasted for this little amount of data we need to store. So this guide uses _SQLite_ instead.
- rsyslogd was a classic choice to write log files like /var/log/mail.log. As Debian is using _systemd_ we no longer
need rsyslogd and logrotate. The logs can be read using _journalctl_ instead.
- The MariaDB table `virtual_users` is renamed to `virtual_mailboxes` because it resembles how Postfix calls them.
# Version changes

View file

@ -10,7 +10,7 @@ Your mail server will have one fully qualified domain name — for example, `pos
domain is `example.com`. If someone visits `https://example.com/`, they might be greeted by the Roundcube webmail login
page.
But your server doesnt have to handle only one domain. You might have users like:
But your server doesnt have to handle only one domain. You might have mailboxes like:
- `jack@example.com`
- `lucy@example.com`
@ -21,8 +21,8 @@ These are three different domains, and your server can handle them all.
This is what _virtual domains_ are for. You give your mail server a list of domains and email addresses and it will
receive emails for them. Your users will also have passwords that they need to type in to retrieve their emails. You can
even set up mailing lists that take messages sent to one address and forward them to several users at once.
even set up mailing lists that take messages sent to one address and forward them to several mailboxes at once.
To make all this work, well store the configuration in a small MariaDB database. Postfix, Dovecot, and Roundcube will
all read from this database to know which domains exist, which users they have, and where each email should go. You will
create that simple database on the next page.
all read from this database to know which domains exist, which mailboxes they have, and where each email should go. You
will create that simple database on the next page.

View file

@ -82,7 +82,7 @@ Debian Trixie, weve disabled chroot mode for Postfix, which means we can now
By now you have an empty database and two user accounts to access it. Now you need three tables:
- virtual_domains
- virtual_users
- virtual_aliases
- virtual_mailboxes
Let's create the entire database schema in one go:
@ -98,7 +98,16 @@ CREATE TABLE IF NOT EXISTS `virtual_domains` (
PRIMARY KEY (`id`)
);
CREATE TABLE IF NOT EXISTS `virtual_users` (
CREATE TABLE IF NOT EXISTS `virtual_aliases` (
`id` int(11) NOT NULL auto_increment,
`domain_id` int(11) NOT NULL,
`source` varchar(100) NOT NULL,
`destination` varchar(100) NOT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (domain_id) REFERENCES virtual_domains(id) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS `virtual_mailboxes` (
`id` int(11) NOT NULL auto_increment,
`domain_id` int(11) NOT NULL,
`email` varchar(100) NOT NULL,
@ -108,15 +117,6 @@ CREATE TABLE IF NOT EXISTS `virtual_users` (
UNIQUE KEY `email` (`email`),
FOREIGN KEY (domain_id) REFERENCES virtual_domains(id) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS `virtual_aliases` (
`id` int(11) NOT NULL auto_increment,
`domain_id` int(11) NOT NULL,
`source` varchar(100) NOT NULL,
`destination` varchar(100) NOT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (domain_id) REFERENCES virtual_domains(id) ON DELETE CASCADE
);
```
{/* <!-- prettier-ignore-end --> */}
@ -138,13 +138,13 @@ represents a domain.
</Aside>
### virtual_users
### virtual_mailboxes
The second table contains information about your users. Each mail account requires one row in this table.
- **id**: A unique number identifying each row. It is set automatically.
- **domain_id**: A [reference](https://en.wikipedia.org/wiki/Foreign_key) to the domain in the `virtual_domains` table.
So each domain can have many virtual users.
So each domain can have many mailboxes.
- **email**: The email address of the mailbox.
- **password**: The hashed password of the mail account. It is prepended by the
[password scheme](https://doc.dovecot.org/main/core/config/auth/schemes.html). By default it is `{BLF-CRYPT}` also
@ -211,7 +211,7 @@ REPLACE INTO virtual_domains
(id, name)
VALUES (10,'example.org');
REPLACE INTO virtual_users
REPLACE INTO virtual_mailboxes
(id, domain_id, password, email)
VALUES (
1,