MAKEHOSTEDDOMAINS(8)

πŸ“¦
version 2.0.6 Β· 3 versions
, in ubuntu stonking

πŸ’– MAKEHOSTEDDOMAINS πŸ’– (section 8 of the manual, bestie, and yeah it's written by S. Varshavchik)

okay so bestie. picture this: a tiny little program that just… rebuilds a database. that's it. that's the whole plot. it's chaotic, it's iconic, and you're gonna love her.


✨ NAME ✨

makehosteddomains β€” she builds you a database of hosted domains πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

makehosteddomains

that's the whole vibe. no flags. no arguments. she just goes.


πŸ¦‹ DESCRIPTION πŸ¦‹

so what does she actually do? makehosteddomains rebuilds the entire contents of the /etc/courier/hosteddomains.dat database, sourcing everything from /etc/courier/hosteddomains. and that source thing? it can be either a file or a directory. no stress either way.

if it's a directory, the contents of every single file inside get simply concatenated. that's it. no sorting, no drama, just vibes stitched together.

⚠️ not me forgetting this part β€” you literally must run the makehosteddomains script for any changes to /etc/courier/hosteddomains to take effect. if you don't run it, your edits are just sitting there. unemployed. doing nothing. 😭

ngl, /etc/courier/hosteddomains and /etc/courier/locals are basically sisters. both config files hand you a list of domains that count as local domains β€” meaning domains whose mailboxes live locally on your machine.

but here's the plot twist, and it's giving main character energy: domains listed in /etc/courier/locals get removed from addresses before the mailbox gets looked up. so if "example.com" is in /etc/courier/locals, then the address <user@example.com> gets delivered to a local mailbox named "user".

if instead that domain is listed in /etc/courier/hosteddomains? then <user@example.com> gets delivered to a local mailbox named "user@example.com" β€” full address, no stripping. periodt.

so like, typically you'd use /etc/courier/locals for domains that match your local system accounts β€” the ones looked up in your system's password database. and /etc/courier/hosteddomains is the one you want when you're running database-based virtual domains, like the ones maintained through an LDAP or a MySQL server. πŸ”₯

the Courier mail server's LDAP and MySQL authentication modules will use the full E-mail address to query the LDAP or MySQL server for where the local mailbox corresponding to that E-mail address actually lives. and the Courier mail server's authuserdb authentication module can also use full E-mail addresses. obsessed. ✨


πŸ“ Contents of hosteddomains πŸ“

so the file /etc/courier/hosteddomains is literally just a list of domains, one per line. for example:

domain.com
example.org

and every domain can optionally be followed by a single tab character to specify an alias for a domain. for example:

domain.com
mail.domain.com<TAB>domain.com
example.com<TAB>domain.com

let's break it down bestie. first we list "domain.com" as a hosted domain. then we also list "mail.domain.com", which is an alias for domain.com. the Courier mail server will take any address of the form <address@mail.domain.com>, rewrite it as <address@domain.com>, and try to deliver the mail to a local mailbox for that name. πŸ’Œ

the third entry does the same exact thing for "example.com" β€” mail addressed to <address@example.com> gets delivered to the local mailbox <address@domain.com>. slay.


🌈 alias@hosteddomain 🌈

this one is a special local mail delivery rule for hosteddomain-listed domains. what it does: it lets the Courier mail server accept mail to any address@hosteddomain, where "hosteddomain" is a domain listed in the hosteddomains file, even when there's no corresponding account for address@hosteddomain. so you can catch the strays. 🫢

want to give delivery instructions for any non-existing address in a hosteddomain-listed domain? here's the two-step, bestie:

  1. Create the local address alias@hosteddomain. for example, if the hosteddomains file contains "example.com", create the local account alias@example.com. this should be a normal account, with its own home directory, userid and groupid.
  2. Create $HOME/.courier-default file in this account, containing the delivery instructions. peep the dot-courier(5) manual page for the available delivery instructions. πŸ“–
⚠️ NOTE that alias@example.com must be a real account, not a mail alias. if you want to forward alias@example.com to another address, put the forwarding instructions in the .courier-default file. that said, alias@example.com can be a clone of another account β€” same home directory, same userid, same groupid. clone era. πŸ‘‘

🌟 β€œWILDCARD DNS” 🌟

yesss wildcard DNS is supported for hosteddomains β€” all you gotta do is place a single period character before the domain name. for example, the hosted domain entry β€œ.domain.com” will cause the Courier mail server to accept mail for β€œanything.domain.com”. iconic behaviour honestly.

the Courier mail server will accept mail for <address@any.thing.domain.com> and attempt to deliver it to the local mailbox <address@any.thing.domain.com>, and if that fails then it will attempt to deliver the mail to the local mailbox <address@.thing.domain.com>, then finally <address@.domain.com>.

πŸ“Œ Note there is a period after the '@' character. if you want all mail for β€œany.thing.domain.com” to be delivered as though it were sent to β€œdomain.com”, you should define an alias for the domain, for example: domain.com .domain.com<TAB>domain.com

🧚 SUBDIRECTORY CHECKS 🧚

/etc/courier/hosteddomains can be a subdirectory instead of a text file. the effect? concatenating all files in that directory (subject to the checks below, bestie πŸ‘‡) and then using the result as the /etc/courier/hosteddomains. here's what gets checked:

  • Files whose names contain a tilde, β€œ~” are skipped over. bye girl πŸ‘‹
  • Files whose names end with the following suffixes result in an error message: β€œ.rpmsave”, β€œ.rpmnew”, and β€œ.dpkg-suffix”. these are backup files created by the package manager when updating to a newer version of the package, and they contain the old or the new version of a configuration file whose settings may be new or obsolete.

the contents of the file whose name does not have the suffix should be checked against the backup. and the backup file should be deleted after making any needed manual changes to the configuration file. clean up your room bestie 🧹

  • Files whose names end with the β€œ.dist” suffix are also treated as a configuration file backup or template, but with the following exception: the β€œ.dist” file gets ignored and automatically skipped over, without any error message, if the suffix-less file exists and its modification time is more recent than the β€œ.dist” file's modification time. newer wins. ⏰

otherwise, an error message gets reported. and resolving that error message is done by either copying the β€œ.dist” file or editing and saving the file without the suffix β€” which results in a newer timestamp. two paths, both valid, choose your fighter. πŸ’…


πŸ‘€ SEE ALSO πŸ‘€

esmtpd(8).


πŸ’œ AUTHOR πŸ’œ

Sam Varshavchik β€” Author


πŸ“Ž NOTES πŸ“Ž

  1. dot-courier(5) https://www.courier-mta.org/dot-courier.html
  2. esmtpd(8) https://www.courier-mta.org/esmtpd.html

and that's the whole page bestie!! πŸŽ€ this one came from the Courier Mail Server, dated 01/10/2026, and yeah β€” it's still MAKEHOSTEDDOMAINS(8) and it's still serving cunt. go rebuild your database, you got this. πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from
  • ubuntu stonking: courier-mta 2.0.6-1 Β· GPL-3+~with-OpenSSL-exception
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms